Hi,
I'm having problems with my VB6 program that merges with a Lahey Fortran DLL. It has been around for over 20 years! The DLL was started around 5 or 10 years ago. My VB6 program may call the DLL 1 or more times with no problems. Then on closing, the program hangs!!! If one doesn't call the DLL, no hanging occurs on closing. Ideas?
1. Phil Brubaker
2. S/N: 001873...
3. Lahey/Fujitsu Fortran 95 Express Release 7.10.02
4. Patch level?
5. OS: Windows 7
6. Example VB6 code:
Private Declare Sub PSDcalc_for Lib "PSDcalc_for.dll" (ByVal fileNam As String, ByRef x_array As Single, _
ByRef spectrum As Single, nptsZ As Integer, npointsZ As Integer, _
t_startZ As Single, t_finalZ As Single, zeroFillZ As Single, sig2Z As Single, _
nPoles As Integer, nZeros As Integer, M_eqs As Integer, M_lags As Integer, _
Mode As Integer, L_pts As Integer, ByVal str_len As Long)
ooo
ReDim x_array(1 To npointsZ) As Single, spectrum(1 To npointsZ) As Single
x_array(1) = 1: spectrum(1) = 1
ChDrive App.path: ChDir App.path
Call PSDcalc_for(fileTemp, x_array(1), spectrum(1), nptsZ, npointsZ, _
t_startZ, t_finalZ, zeroFillZ, sig2Z, _
nPoles, nZeros, M_eqs, M_lags, Mode, L_pts, _
Len(fileTemp))
If nptsZ < 1 Then
MsgBox "File Error ... read bottom of your '~rainbow.out' file for " & vbCrLf _
& "more details. This OUT file is in the same directory " & vbCrLf _
& "as your input file; ... " & vbCrLf _
& " " & fileTemp, vbOKOnly, "File name in error ... " _
& "read Output file for more"
Call createFileOut(fileIn)
Exit Sub
End If
Call createFileOut(fileIn)
ooo
-------------------------------------------------------------------------------------
F90 code:
------------
Subroutine PSDcalc_for( fileNam, x_array, spectrum, nptsZ, &
npointsZ, t_startZ, t_finalZ, zeroFillZ, sig2Z, &
npolesZ, nzerosZ, M_eqsZ, M_lagsZ, modeZ, L_ptsZ)
dll_export :: PSDcalc_for
character(len=*) :: fileNam
include 'spec_in.inc'
complex signal_amp( :)
real y_array( :), norm_factor
real, dimension( npointsZ) :: x_array, spectrum
allocatable :: y_array, signal_amp
--------------------------------------------------------------------------------------
This code works, can call PSDcalc_for several times ... AOK. Then try closing my VB6 front-end and vb6 seems to hang. Create an EXE for my project and it too runs fine until closing. Then it tries closing and gets the same error msg.
This app has been running since 1994 (?) with no problem, what is new that causes such error? I found a back-up with same DLL, back in 2015, and it too aborted with same error! The app is not used that often by me, so unclear when this shutdown error msg. started.
Any ideas on how to close down my Fortran DLL, without forcing it just a 'normal' close?
Thanks, Phil