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

DLLEXPORT Property for Data with Fortran PARAMETER Attribute

blamm
Beginner
1,031 Views
I submitted a problem report for IVF 8.1 and was convinced that I was correct in assuming that data in a Fortran MODULE could be exported by using !DEC$ ATTRIBUTES DLLEXPORT :: ... . I created a DLL containing several MODULES all but one of which had at least some data that were given the DLLEXPORT property, and ONE of those Fortran modules contained "global" data to be used by other DLLs and EXE. What I received back from Intel was enlightening, to say the least. Find following a portion of my response.
First, I was informed that data with the PARAMETER attribute could not be given the DLLEXPORT property and expected to be in the DLL's export table, to which I replied ...
"Regarding the DLL exported symbols. I would like you to show me WHERE IN THE DOCUMENTATION it is explained that PARAMETERs cannot be exported."

You wrote "The compiler will DLLEXPORT parameter constants that end up creating global symbols", well, HOW DO I KNOW **WHICH** parameter constants will end up being "global"?

You also wrote "If the program using the DLL wants these symbols defined, they should be in a module that is USEd." But, THAT IS **EXACTLY** WHAT I DID! I have defined ALL VARIABLES AND PARAMETERS IN **ONE** MODULE THAT IS USEd BY DLLs AND EXE THAT NEED THE VARIABLES AND CONSTANTS DECLARED AND/OR DEFINED IN THAT FORTRAN MODULE WHICH IS PART OF THE DLL FROM WHICH I NEED EXPORTS.

To reiterate: I created ONE Fortan MODULE that contains ALL THE GLOBAL variables and constants that OTHER DLLs and one EXE need, and that ONE Fortran MODULE is in the DLL that will NOT export the **global** data symbols that the other DLLs and EXE have USEd, which is implementing PRECISELY WHAT YOU SUGGESTED WHEN YOU WROTE "If the program using the DLL wants these symbols defined, they should be in a module that is USEd." Fortran MODULE "mod_global_model_data" **is** USEd by other program units in other DLLs and other program units in the EXE!

So now you must explain to me why it was incorrect of me to do PRECISELY WHAT YOU SUGGESTED.
Can anyone shed some useful light on this subject? I cannot find in the IVF documentation any one place or combination of places that effectively end up communicating that data with the PARAMETER attribute cannot be exported from a DLL, and I also cannot find in the documentation anywhere an explanation of *where* the compiler will decide that data is global and where it will decide data is not global, if it all.
0 Kudos
7 Replies
Steven_L_Intel1
Employee
1,031 Views
I suggest that you submit an example showing what you are trying to do. There are many working examples of Fortran module DLLs built with exported symbols and having the PARAMETERs visible to the Fortran user of the DLL (a USE of the module is required.)
I would also suggest that if you are dissatisfied with or don't fully understandthe response from Intel Premier Support that you first try to resolve the issue with Premier Support.
0 Kudos
blamm
Beginner
1,031 Views
Examples? I haven't gotten examples with IVF downloads for I don't how long now. Where are those examples you wrote of?
I did reply to Intel Premier Support;I was wondering whether anyone OUTSIDE of Intel had run into this issue and if they had any suggestion(s), thank you very much.
The Fortran MODULEcontaining every one of the data with the PARAMETER attribute and the DLLEXPORT propertyis USEd by other program units, but not necessarily by program units that are built at the time this DLL is.
0 Kudos
Steven_L_Intel1
Employee
1,031 Views
I meant an example of what your code wanted to do. All you should need to do is add a USE for the module to the program that wants the data, and supply the .mod file built when the module was compiled. I've attached a sample solution that does this.
0 Kudos
Steven_L_Intel1
Employee
1,031 Views
Hi, Brian. I found your Premier Support request and will assist with the case there.
0 Kudos
blamm
Beginner
1,031 Views
Hi Steve!
Okay, I'll look for you on Premier. I have some confusion about the example you provided. I'll write about it in Premier.
Thanks again.
0 Kudos
blamm
Beginner
1,031 Views
Hi Steve!
Okay, I'll look for you on Premier. I have some confusion about the example you provided. I'll write about it in Premier.
Thanks again.
0 Kudos
blamm
Beginner
1,031 Views
Hi Steve!
Okay, I'll look for you on Premier. I have some confusion about the example you provided. I'll write about it in Premier.
Thanks again.
0 Kudos
Reply