View previous topic :: View next topic |
Author |
Message |
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Tue Jun 07, 2016 8:27 am Post subject: Using constants declared in a module in different DLLs |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7916 Location: Salford, UK
|
Posted: Tue Jun 07, 2016 8:55 am Post subject: |
|
|
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 |
|
|
|