Re: passing file unit numbers to DLL functions

From: Catherine Rees Lay (spamtrap_at_polyhedron.org.uk)
Date: 02/12/04


Date: Thu, 12 Feb 2004 09:13:37 +0000

In article <33997531.0402110702.829489e@posting.google.com>, Sreelal
<sreelal2244@yahoo.co.in> writes
>Dear all,
>
>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.

-- 
Catherine Rees Lay
To email me, use my first name in front of the "at".


Relevant Pages

  • Re: passing file unit numbers to DLL functions
    ... > I'm a new user of Digital Visual Fortran. ... I wanted to create a dll and access the function inside ... When I call the dll function, ... subroutines of the exe which are exported as needed to the DLL. ...
    (comp.lang.fortran)
  • Re: passing file unit numbers to DLL functions
    ... | I'm a new user of Digital Visual Fortran. ... I wanted to create a dll and access the function inside ... When I call the dll function, ... "Multi-threaded DLL" for BOTH dll and exe. ...
    (comp.lang.fortran)
  • Re: Error 1829 from a Webservice
    ... I did try a WebService with IIS 5.1 using Visual Studio 2003 on WinXP. ... --> DLL internally connects to db ... --> calls DLL function ...
    (comp.databases.informix)
  • Re: Error 1829 from a Webservice
    ... By "It fails in webservice" I mean, only the connection. ... --> DLL internally connects to db ... --> calls DLL function ...
    (comp.databases.informix)
  • Re: int arrays between C# and C++
    ... the C++ dll function, I cannot tell you a definitive answer but you can try ... attribute to your parameter/return type. ... Shell MegaPack: GUI Controls For Drop-In Windows Explorer like Shell ...
    (microsoft.public.dotnet.languages.csharp)