Re: passing file unit numbers to DLL functions
From: Catherine Rees Lay (spamtrap_at_polyhedron.org.uk)
Date: Thu, 12 Feb 2004 09:13:37 +0000
In article <firstname.lastname@example.org>, Sreelal
>I'm a new user of Digital Visual Fortran. I hail from Finite Element
>background. So my knowledge in programming is very limited.
>I'm stuck up with a silly problem. I'm dealing with some pretty old
>fortran code. I wanted to create a dll and access the function inside
>the main program. I was successful in creating the dll and the
>arithmatic part is working perfectly fine. Sharing of the variables
>was also fine. But I've opened a file in my main program and was
>reading some records from there. When I call the dll function, I want
>that particular dll function also to read some data from the already
>opened file. This is not happenning !! It is expected, but dont know
>how to pass the file handle to the dll when the call is invoked!
>In short, I dont know how to deal with files when you want your main
>progrm as well as the dll to use the same files !!
>Any help is highly appreciated.
>Thanks in advance....
Others have told you how to do this, I still think you need to ask
yourself why you're doing it. If the 2 bits of code are sufficiently
interlinked that they read and act on consecutive bits of data from the
same file and can only be called in a particular order as a consequence,
I'd say they should be in the same place (either both in the EXE or both
in the DLL). You could consider reading the data in the EXE and passing
it to the DLL function, so the DLL never needs to know about the data
file at all.
-- Catherine Rees Lay To email me, use my first name in front of the "at".