- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
What is the correct way to generate a shared library from a module?
I currently use ifort -share -fpic mymod.f90
Actually, it works as expected, however there is a small question regarding private variables. As far as I see all variables are exported in the generated library. Which means they all are accessible after such a library is loaded. I would expect private variables not to be exported. Am I missing something?
Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See my reply to your post in comp.lang.fortran - quoted here.
The private accessibility applies only to the Fortran language view of the module as to their accessibility when the module is USEd. A global/exported symbol may still be required in order for the program to function. For example, a generic interface may have the generic name public but the specific names private. The compiler still needs to be able to reference the specific names for linking, so they need to be visible in the shared library. You just can't reference them in the source.
It's also possible to have the name be inaccessible in one part of the program and accessible in another.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, thank you very much for your answer.
I have another small question. When I compile a module (say testmod) with ifort there is text segment (code) in the object file named testmod._ . Can you explain what function is this. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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