View previous topic :: View next topic |
Author |
Message |
viroxa
Joined: 28 Jul 2017 Posts: 78
|
Posted: Mon Jul 31, 2017 10:41 am Post subject: DLLs - Global Parameters, Pure Subroutines |
|
|
Hello, Everyone,
Is there a way to store global parameters in a .DLL? If so, how can they be called? I've tried
Code: |
MODULE mod_double
IMPLICIT NONE
! Double precision
INTEGER,PARAMETER::DP=KIND(0.0D0)
END MODULE mod_double |
in the DLL but when using the parameter in a program I got a message, that a constant was expected.
------------------------
The other issue is the PURE attribute, which seems to get lost somewhere on the way. As long as the pure subroutines are called from internal modules, it works just fine. But as soon as they're called from DLLs, they aren't pure anymore. Any advice on that?
Thanks a lot! |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7934 Location: Salford, UK
|
Posted: Mon Jul 31, 2017 1:35 pm Post subject: |
|
|
You can store parameters in a DLL but you can't access them directly by name. You could provide a function that maps an index for each parameter to the output of the function. |
|
Back to top |
|
|
viroxa
Joined: 28 Jul 2017 Posts: 78
|
Posted: Mon Jul 31, 2017 7:17 pm Post subject: |
|
|
Thanks for the advice.
Do you also have an idea, why PURE functions/subroutines don't remain pure? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7934 Location: Salford, UK
|
Posted: Mon Jul 31, 2017 8:33 pm Post subject: |
|
|
I may have to pass on that question. How do you know that they are no longer PURE and why is it of interest? |
|
Back to top |
|
|
viroxa
Joined: 28 Jul 2017 Posts: 78
|
Posted: Tue Aug 01, 2017 10:18 am Post subject: |
|
|
I apply them to arrays using FORALL. Before i moved them to the DLL it worked, now I get an error, stating that PURE functions/subroutines are required.
I'll also include that in the example from the other thread (http://forums.silverfrost.com/viewtopic.php?t=3555). |
|
Back to top |
|
|
|