Re: SAVE of COMMON variables



Brian Elmegaard wrote:
Hi

I compiled a fortran program into a dll with gcc.

In the program several variables are stored in COMMON's. I would like
to have these SAVE'd between calls to the dll, but gcc will not let me
compile something like:
program comsave
integer a
common /b/ a
save a
a = 10
end

Is it not allowed/possible?

http://www.rugbyklubben-speed.dk

I don't think this is really a fortran issue. In fortran 77 all common
blocks are statically allocated, and values are saved across calls to
subroutines. Otherwise how would block data work? However, you are
asking if common storage is reset when the main program is rerun. I
expect it would be, but I am unfamiliar with the behavior of Windows
DLLs. Have you tried it out? I would be very skeptical of any fortran
based solution to this problem, as an apparent solution might depend
on the DLL not moving between invocations (does that happen)?

I think you are supposed to use the registry or the file system for
things like this.

Daniel Feenberg
feenberg isat nber dotte org

.



Relevant Pages

  • Re: Look at this before considering to use Intel Visual FORTRAN
    ... > FORTRAN is definitely not the first choice. ... > workaround by writing a COM-Wrapper in DVF, so the DLL runs in the DVF ... > Intel Customer Support ...
    (comp.lang.fortran)
  • Re: exporting functions/subs from fortran?
    ... It's nice to hear other developers with your caliber exist. ... Yes I did dismiss the other options regarding the DLL development (in-proc, ... >> but this project is all FORTRAN and I figured this would be a good place ... >> the fact that I'm calling code in an exe from another exe and the first ...
    (comp.lang.fortran)
  • Re: Threading and DllImport
    ... DLL has already been loaded. ... various unpredictable errors from within the FORTRAN code, ... I don't know anything about "Intel Thread-Checker". ... were able to reproduce the problem in a simple example. ...
    (microsoft.public.dotnet.framework)
  • Re: DLL Problem Laufzeitfehler RTL (Manifest?)
    ... Benutzerschnittstellen zu FORTRAN bereitstellt. ... Da ich aber mit C++ arbeite habe ich eine DLL mit MS Visual C++ geschrieben die von einem sehr kleinen FORTRAN Programm aufgerufen bzw. genutzt wird. ... In de alten Version mit ABAQUS 6.4 und MS Visual Studio 2003 sowie dem Intel FORTRAN Compiler 6.5 funktionierte das auch wunderbar. ...
    (microsoft.public.de.vc)
  • Fortran dll compiles, but runs differently, under different compilers
    ... We compile the Fortran into a dll and call it from the C++ ... which was compiled over a year ago by Microsoft's Visual Fortran ...
    (comp.lang.fortran)