Re: CVF DLL, problems reading binary file
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Sat, 11 Mar 2006 22:58:25 GMT
johan@xxxxxxxxxxxxxx wrote:
Hi,You don't give a lot of information here. How different are
I have a problem concerning a big scientific computing program written
in Compaq Visual Fortran which I'm trying to convert to a DLL to be
called from Visual Basic. The problem is that when I'm reading a binary
file, and print the results at the prompt, using the existing program
the VB/DLL respectively, I don't get the same values, causing the
program to stop.
I don't see any reason why a .EXE program and a DLL, based on the same
code, should give different values reading a simple binary file. Does
anyone have an answer? Has anyone had the same problem?
the values? Does everything come out zero in one scheme?
Or does it like like the values are reasonable, but in the
wrong place?
The normal reason for getting different answers for the
"same code" when it is compiled differently is that you
are getting some sort of subscript out of bounds. Turn on
all of the run-time debug checks you can find, especially
ones that check subscripts and subroutine argument matching.
Use the IOSTAT=integer_variable on the READs and see if
anything interesting is being reported. Some compilers
silently ignore some features (the kind that others call
errors) and "do the right thing for you". This might be
a problem if, for example, the DLL version does a different
kind of magic for you.
Do an INQUIRE after the OPEN and print out everything
you can inquire about. It's possible the run-time library
does something different in one version.
Try setting all of the arrays to some unusual value and then scanning each array after the read to see if the right
amount of reasonable data is being read.
The silly one, that everybody in the world does at least
once; are you doing your testing in two different
directories? If so, then the OPEN might be getting
different files in the two versions.
Are you sure you've got a good example here and didn't
make a simple type? The subroutine has an argument
that doesn't appear to be used. Did you leave something
out?
Hope some of this helps,
*** Hendrickson
Sincerely
Johan
The code is:
SUBROUTINE RADIN(NPRT)
PARAMETER (NA=20,NMB=37)
CHARACTER*3 MBAND
CHARACTER*4 ALINE
C
c... atomic data
C
COMMON/RADA/ATOM(2,NA),LATOM(4,NA),GLEV(8,2,NA),ELEV(8,2,NA),
& BLINE(13,1500,NA),NBFCON(2,35,NA),BFCON(14,35,NA),
& TFF(5),EEFF(6),FFCON(6,5,NA),ALINE(2,NA)
C
c... molecular data
COMMON/RADB/AMOLEC(NMB),LMOLEC(6,NMB),SPEC2(8,2,NMB),
& VIB(4,480,NMB),MBAND(2,NMB)
C
OPEN (UNIT=10,FILE='radcal.inp',STATUS='old',FORM='UNFORMATTED')
C
c... read atomic data
C
READ(10) ALINE
READ(10) ATOM
READ(10) LATOM
READ(10) GLEV
READ(10) ELEV
READ(10) BLINE
READ(10) NBFCON
READ(10) BFCON
READ(10) TFF
READ(10) EEFF
READ(10) FFCON
C
c... read molecular data
C
READ(10) MBAND
READ(10) AMOLEC
READ(10) LMOLEC
READ(10) SPEC2
READ(10) VIB
C
CLOSE(10)
WRITE(*,*) 'AMOLEC', AMOLEC
WRITE(*,*) 'Testing in RADIN VIB:', VIB(1,1,10), VIB(1,2,10)
WRITE(*,*) 'Testing in RADIN VIB:', VIB(1,3,10), VIB(1,4,10)
RETURN
END
.
- References:
- CVF DLL, problems reading binary file
- From: johan
- CVF DLL, problems reading binary file
- Prev by Date: Re: Converting fixed-to-free format
- Next by Date: Re: Converting fixed-to-free format
- Previous by thread: CVF DLL, problems reading binary file
- Next by thread: Re: CVF DLL, problems reading binary file
- Index(es):