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 

Using constants declared in a module in different DLLs

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



Joined: 02 Aug 2005
Posts: 317

PostPosted: Tue Jun 07, 2016 8:27 am    Post subject: Using constants declared in a module in different DLLs Reply with quote

I may just be breaking a Fortran rule, but i have the following problem:

i have a constant declared in a module:

MODULE NMR_CONSTS

INTEGER :: Q_CMP=123

and when NMR_CONSTS is USEd inside our main "large" DLL it is set correctly but in another "small" DLL it is zero - but attempting to change it:

IF( Q_CMP.LE.0) Q_CMP=123

causes a memory violation at runtime.

Apparently, the second DLL "understands" that i'm trying to overwrite a constant (which I assume is why it crashes), but why doesn't the value of the constant survive the call into the second DLL and is there any way of making it do so?

Just to note that the second DLL is different for different end users and i don't want to have to send our "large" DLL out on a customer-by-customer basis, but I can happily send out the "small" one...

K
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: Tue Jun 07, 2016 8:55 am    Post subject: Reply with quote

In the ordinary way, you can't share module data in this way between different DLLs nor between a DLL and the main exe. There is no linkage for this data. There are various ways to get around this limitation. Perhaps the simplest is to use function calls to set/get the shared data.
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