- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had Studio 2003 projects accessing fortran DLL subroutines built with Intel 9.0. Now I've upgraded to Studio 2005 and Intel 9.1 andI'm getting link errors whenever I try to call a fortran subroutine from C++. Any thoughts? I've read the install and release notes and see no mention. This worked before the upgrade. Do I need to remigrate the fortran projects somehow?
Link Copied
9 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What do the errors say?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm getting unresolved external errors. I verified within Studio that I reference the Fortran DLL from the C++ DLL as a dependency within the solution. Again this worked before the Visual Studio and IVF upgrades (2003->2005 and 9.0->9.1 respectively). Any help would be appreciated.
Example Error:
error LNK2019: unresolved external symbol _FORTRANSUBROUTINENAME@16 referenced in function "public: long __thiscall CMyCPLUSPLUSCLass::MyMethod(long *,double * const,double * const)" (?MyMethod@CMyCPLUSPLUSCLass@@QAEJPAJQAN1@Z)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The linker message says that FortranSubroutineName is declared in C++ as __stdcall. The IVF default has always been __cdecl, so the dll has either been built with /iface:CVF or with explicit !DEC$ATTRIBUTES STDCALL, ALIAS:. Check the actual dll exports with Dependency Walker (depends.exe) or dumpbin.exe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've heard recently, though I haven't seen it myself yet, that a mixed C/Fortran VS2005 solution with a Fortran library may not include the Fortran library even though it is a dependent project. You can try adding the Fortran .lib explicitly to the C++ project if this is happening to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes with an explicit dll link reference, I can link - the project dependencies within the Visual Studio 2005 solution does not seem to work as it did in previous releases when dealing with C++Dlls referencing Fortran DLLs.
Thanks for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also had the same problem with linking Fortran in 2005. Adding the lib worked for me as well.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can now confirm - Microsoft changed VS2005 so that C++ projects do not ask other non-C++ projects about build outputs, even though MS provides a supported interface for doing so (that we implement and which worked in VS2002-2003.) So if you have a C++ main, you'll have to manually add the .lib of the Fortran project to the C++ project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've just converted to VF9.1. May I glean from the above discussion that I should not have any problems running a particular Fortran DLL under both Fortran console apps and Fortran Windows apps?
Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't think of any reason you should have an issue with that.

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