For Programmers: Free Programming Magazines  


Home > Archive > Fortran > August 2005 > Re: dlls remembering allocatable arrays









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: dlls remembering allocatable arrays
Jugoslav Dujic

2005-08-20, 6:59 pm

Bruce M wrote:
|| I am writing Windows dll's in DVF 6 for a Delphi front end. This
|| particular dll needs to be left in memory and called multiple times. I
|| want to create and load some allocatable arrays on the first call to
|| the dll, then use the data on subsequent calls to the same dll. Even
|| though I use the "SAVE" attribute for the arrays, the data disappear
|| between subsequent calls. Not so for simple variables -- those are
|| remembered. Btw, the front end doesn't need or use the data needed by
|| the dll.
||
|| I'd greatly appreciate a tip on how to make the data in allocatable
|| arrays accessible on subsequent calls to the dll.

All I can say is "this exact setup works for me". (Even with option
"Variables default to AUTOMATIC"). I have CVF 6.6C but I doubt that makes
a difference. Delphi version is 7, IIRC (other guys build that part).

I suspect the problem is that that the dll and/or CVF runtime dll gets
unloaded
somehow.

Try:
1) Build your Dll with static version of RTL (/libs:static). You don't need
the dll version anyway (since you'll also have to redistribute
dforrt.dll).

2) You can examine whether the dll is permanently loaded by calling
GetModuleHandle('yourdll.dll') api in-between calls. If the dll gets
unloaded,
you will get a nil. If so, try calling LoadLibrary once on the startup --
that should prevent it from being unloaded.

--
Jugoslav
www.geocities.com/jdujic

Please reply to the newsgroup.
You can find mu real e-mail address on my home page above


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com