Silverfrost Forums

Welcome to our forums

DLLs - Global Parameters, Pure Subroutines

31 Jul 2017 9:41 #19912

Hello, Everyone,

Is there a way to store global parameters in a .DLL? If so, how can they be called? I've tried

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!

31 Jul 2017 12:35 #19914

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.

31 Jul 2017 6:17 #19915

Thanks for the advice. Do you also have an idea, why PURE functions/subroutines don't remain pure?

31 Jul 2017 7:33 #19917

I may have to pass on that question. How do you know that they are no longer PURE and why is it of interest?

1 Aug 2017 9:18 #19924

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 (https://forums.silverfrost.com/Forum/Topic/3152).

Please login to reply.