Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29245 Discussions

sharing entire modules between dll and main program

Pam_R_
Beginner
636 Views

hi guys

i have one major problem right now. After figuring out how to transfer data between dll and main program

i want to know how to transfer all data objects of a module and possibility of having several entire modules sharing between dll and main program

if i have to use DEC$ ATTRIBUTES EXPORT for each data objects of each module. i would have to add those statements 1000 times for 20 modules that i want to share

is there any easy way of doing this

thanks in advance

0 Kudos
4 Replies
Steven_L_Intel1
Employee
636 Views
You have to name each thing to be shared in a DLLEXPORT directive. There is not an option to export everything, though we have had that requested before.

For routines, it's sufficient to have a DLLEXPORT directive in each routine. For variables, there must be only one definition of the variable that is exported, so I am a bit unclear on the "1000 times for 20 modules" part, unless you have 20000 distinct things you want to export.
0 Kudos
Pam_R_
Beginner
636 Views

when i say 1000 times for 20 modules i mean

i have 20 modules with data objects. Almost each module has atleast 500 to 1000 variables.

even if i do $DEC ATTRIBUTE DLLEXPORT :: variables ...

i still have to add all the variables in the export list.

So, i was hoping if just by doing export on module itself, we should be able to share data

unfortunately when i try $DEC ATTRIBUTES DLLEXPORT :: module_name

the warning message i get is "eventhough attribute dllexport :: module_name is valid statement

it does not have any effect.

so i assume at this point there is no way to export entire module by one statement

thanks for the help

it clears lots of doubt

0 Kudos
Steven_L_Intel1
Employee
636 Views
Correct - there is not a way to export everything in a module. My mind boggles, though, at the notion of an application where one wants to share tens of thousands of variables with a DLL. What type of application is this?

0 Kudos
Pam_R_
Beginner
636 Views

we are working on a legacy fortran code. the code initially was in fortran 77 with about 20 include files and total of 30 to 40 commons. there are about 120 subroutines in the main program

the objective of creating a dll is that we can give executable with dll functionality to client. they can add their on functions in dll to do calculations without having us to modify the code for them. so we have to create few function in main program which calls dll functions. user can either use default dll's or provide their on.

we have 2 version of the program f77 version using commons in include files

and f95 version using modules

so using modules is out of question for now

for include files, i have few misconceptions

1) i have a common in include files and i want to share those commons between dll and application

i do $DEC ATTRIBUTES DLLEXPORT :: /common1/ in dll routines and

$DEC ATTRIBUTES DLLIMPORT :: /common1/ inapplication routine routine_1.

this shares data between dll and application routine_1

now if common_1 is used by some other routine i.e. routine_2 of application

do i have to do DLLIMPORT :: /common1/.

if i do not do DLLIMPORT :: /common1/ on routine_2, i do not see the updated common1. i see 0 values for all common variabls

please clarify

thanks in advance

0 Kudos
Reply