- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would someone direct me to some reference material on howCOMMON and BLOCK DATAare handled differentlywhen compiling consol applications executablesversusstaticlibrary for the same FORTRAN routine.
Here is a brief description of my challenge: I have a FORTRAN program that compiles and runs correctly when I compile as a consol application executable. Now I need to make this program a library, I changed the PROGRAM XYZ to SUBROUTINE XYZ and added the following compiler directive "!DEC$ ATTRIBUTES DLLEXPORT :: XYZ". The library compiles and runs, but the outputis not correct. Using WRITE statements in both the consol application and libraryversions we traced it down to variables in COMMON blocks that were not the expected values in the library.
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For example, if the BLOCK DATA is named MYBLOCK, add:
EXTERNAL MYBLOCK
to something in the code that needs the COMMON.
I'm a bit confused about your mention of DLLEXPORT - are you building a DLL? If so, and if you expect the COMMON to be shared between the DLL and the console program, you have more work to do - mainly, add a:
!DEC$ ATTRIBUTES DLLEXPORT :: /commonname/
directive for the COMMON in the BLOCK DATA subprogram and add a
!DEC$ ATTRIBUTES DLLIMPORT :: /commonname/
in any source that references the COMMON.
If you are building a static library, you don't need DLLEXPORT/DLLIMPORT.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page