forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting Variables in Modules from a DLL

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
dpannhorst



Joined: 29 Aug 2005
Posts: 165
Location: Berlin, Germany

PostPosted: Mon Aug 29, 2005 9:26 am    Post subject: Getting Variables in Modules from a DLL Reply with quote

Hello everybody,

I want to use the same variable in a main program and in a subroutine in a DLL. Therefore I am using in the main program and in the DLL's subroutine the same MODULE containing the definition of my variable. In the main program I set a value to the variable, but the value in the DLL's subroutine stays everytime at zero! What have I to do to share the variable between main program and DLL? (Compaq Fortran offers a DLL-Export / Import of variables).

Detlef Pannhorst
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Aug 31, 2005 4:07 am    Post subject: Getting Variables in Modules from a DLL Reply with quote

At the moment FTN95 does not enable you to link a common block (or module data)
across a main program and a DLL or across two DLLs. If you use the Salford
intrinsic LOC to get the addresses you will find that the two sets of data
have different address spaces.

This limitation already appears on the wish list of things to do when time and resources permit.

What is needed is an EXTERNAL attribute that can be attached to a common block (or module data)
in a way that is analogous to subprograms. Incidentally, you can embed a common block in a
module so adding the feature for a common block alone may be sufficient.

A rather poor alternative is to put all the data into one array (using EQUIVALENCE statements
for the variables) and to pass this array on each call. Since the array is passed by reference,
the overhead is minimal. You could also put the relevant code in an INCLUDEd file.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group