We have a main dll with calculations and in this dll there are have many modules.
We want to add a post-processor but this will be placed in a separate dll In this separate dll the idea is to use modules with results from the main dll.
I have tested with a small post processor dll and now it is working (with some problems on the way) so variables from modules in the main dll are available in the post Proc. dll.
My test example:
In main dll I have this module:
!dec$ attributes dllexport :: a
!dec$ attributes dllexport :: b
I set a b to some variables and then I export the module:
!dec$ attributes dllexport :: test
When this is done I use a and b in the separate post-proc. dll and they are correct
This is fine but for the real case I have many hundreds/thousands of results in many modules.
I have tested to comment out dllexport for a and b but then it did not work.
My question: Is there a command or trick to avoid adding dllexport for all variables in my modules?
Sorry, no. All variables must be explicitly exported. At least when you USE the module, the DLLEXPORTs are converted to DLLIMPORTs automatically.
Do you really have that many separate variables to share from the DLL? Maybe you need to take another look at program structure.
Thanks for information !
After I wrote my question I looked around and found another thread ( 301019 from 2008) and the same request was in the wish-list. Maybe next version?
Why not use:
! In main dll I have this module: module test type test_t real a real b end type test_t type(test_t) :: test_data !dec$ attributes dllexport :: test_data end module
I'll be honest and say that I don't think an "export everything" option is a good idea. While it's on our list of requests, it's not something we're considering at this time.
In addition to Jim's suggestion, if you put the shared variables in a COMMON and DLLEXPORT the COMMON, that would be a way of getting the variables shared without having to name them individually. I'm a bit hesitant to suggest this as COMMON is considered obsolescent, but you can put COMMON in a module.
Here's a short example demonstrating this.
module mymod common /foo/ a,b,c !DEC$ ATTRIBUTES DLLEXPORT :: /foo/ contains subroutine init !DEC$ ATTRIBUTES DLLEXPORT :: init a = 42. b = 23. c = 19. end subroutine init end module mymod
program test use mymod implicit none call init print *, a,b,c end