- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have converted a patricularproject from CVF to VS2008/Intel 11.1.060 using the conversion tool. The result is a C++ wrapper DLL referencing a Fortran static library. (This all being within some larger solution mostly C++ code, which uses the dll and thence the fortran)
When the DLL is entered it transpires that data which used to be initialised by a BLOCKDATA statement in one of the fortran files is no longer initialised correctly. After scanning this forum I found a workround, which is to put the blockdata name preceded by an underscore as en entry in the "Force symbol references" section of the linker input (of the C++ project that is, not the fortran one).
This does indeed solve the problem, but smells like a workround not the correct approach. There was another reference that perhaps the blockdata name should be declared as external. So I tried this - inserting EXTERNAL inside one of the subroutine entry points into the Fortran static library - and this works too.
I'm somewhat confused by what is going on though - I suppose it because the linker is now operating on the C++ project not the FORTRAN one? Is the external declaration the right approach anmd and if so what is the "right" place(s) to insert the external statements. Any advice anyone?
When the DLL is entered it transpires that data which used to be initialised by a BLOCKDATA statement in one of the fortran files is no longer initialised correctly. After scanning this forum I found a workround, which is to put the blockdata name preceded by an underscore as en entry in the "Force symbol references" section of the linker input (of the C++ project that is, not the fortran one).
This does indeed solve the problem, but smells like a workround not the correct approach. There was another reference that perhaps the blockdata name should be declared as external. So I tried this - inserting EXTERNAL
I'm somewhat confused by what is going on though - I suppose it because the linker is now operating on the C++ project not the FORTRAN one? Is the external declaration the right approach anmd and if so what is the "right" place(s) to insert the external statements. Any advice anyone?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In CVF, the BLOCKDATA object was always explicitly linked in because all the sources were in one project. Now that it is in a library, an external reference is needed to make sure it gets pulled in. Adding EXTERNAL to any of the routines in the Fortran code that is referenced by the C++ code is a good solution.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In CVF, the BLOCKDATA object was always explicitly linked in because all the sources were in one project. Now that it is in a library, an external reference is needed to make sure it gets pulled in. Adding EXTERNAL to any of the routines in the Fortran code that is referenced by the C++ code is a good solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Understood, thanks.

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