- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I'm using Visual Fortran for Windows and I can't solve the problem of exporting allocatable arrays defined and allocated inside my subroutines...I'd like to export them in my main but I don't know how.
I would avoid solutions like modules because the ultimate aim of my job is to generate .dll libraries.
Is there any way to export dynamic arrays from subroutines that will become part of a dll?
Thanks for your attention.
Your sincerely
Roberto
I'm using Visual Fortran for Windows and I can't solve the problem of exporting allocatable arrays defined and allocated inside my subroutines...I'd like to export them in my main but I don't know how.
I would avoid solutions like modules because the ultimate aim of my job is to generate .dll libraries.
Is there any way to export dynamic arrays from subroutines that will become part of a dll?
Thanks for your attention.
Your sincerely
Roberto
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First of all, dllexporting global data does not quite match my idea of clean interface. The most common approach is to let the caller allocate the storage and pass it to your routine as an assumed-shape array. The second best approach is that you dllexport two or three routines - one to allocate storage, second to return pointer to it to the caller (one can do both), and third to free it. What language is that supposed to be called from?
Further, an allocatable array cannot be global unless it's in a module -- why do you think that modules are incompatible with dlls? The following is supposed to work (I didn't test it)
Jugoslav
Further, an allocatable array cannot be global unless it's in a module -- why do you think that modules are incompatible with dlls? The following is supposed to work (I didn't test it)
MODULE MyModExport REAL, ALLOCATABLE:: AnArray(:) !DEC$ATTRIBUTES DLLEXPORT, ALIAS: "_AnArray":: AnArray END MODULE MyModExportIn the caller:
MODULE MyModImport REAL, ALLOCATABLE:: AnArray(:) !DEC$ATTRIBUTES DLLIMPORT, ALIAS: "_AnArray":: AnArray END MODULE MyModImport
Jugoslav

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