- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to import some module data that is stored (and exported) from a dll. Also, I have a module.dll that exports a variable (cubature2Dt_lengths) and then in my main code I want to use this variable.
module.dll:
-----------------------------
MODULE cubature2Dt
!DEC$ ATTRIBUTES DLLEXPORT ::cubature2Dt_lengths
IMPLICIT NONE
INTEGER, DIMENSION(10), PARAMETER :: cubature2Dt_lengths=(/1,3,4,6,7,9,13,16,19,25/)
END MODULE cubature2Dt
------------------------------
code in exec that imports module.dll:
-------------------------------
SUBROUTINE subr(a1)
!DEC$ ATTRIBUTES DLLIMPORT ::cubature2Dt_lengths
USE cubature2Dt,
-------------------------------
but this results in a compiler option (two times defined cubature2Dt_lengths- with dllimport, and with USE statement). And then, if I remove the "DLLIMPORT" line, a unresolved symbol linker error appears. This linker problem does not happen with subroutines or single variables (doubles, integers) defined in the submodule. Is there any issue with arrays inside modules like the one in my example? Is it possible what I'm trying? How should this be done?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please build and run the DLL_Shared_Data example in the compiler installation folders. If you do not configure and build the code correctly, what will happen is that both the DLL and the EXE contain separate copies of the module data, including the array that is of concern to you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please build and run the DLL_Shared_Data example in the compiler installation folders. If you do not configure and build the code correctly, what will happen is that both the DLL and the EXE contain separate copies of the module data, including the array that is of concern to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That example was just perfect for my purpose. The only thing I had to do was to use the !DEC$ ATTRIBUTES DLLEXPORT statement below every variable I needed. Now the code works without problems.
Thanks a lot.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page