- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We intend to build a Fortran libraryusing IVF (could be static or a DLL, but we prefer static). We would like to link the library intoa C++ program. The machine on which the C++ program will be built does not have IVF installed, only Visual C++. Will this work, or could there be unresolved references to other IVF libraries from within our Fortran library? Is there a way to make this work without installing IVF on the C++ build machine?
Thanks,
Steve
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to also distribute one or more .lib files from the compiler's /Lib folder. All of them, I think, are redistributable. There is a file fredist.txt in the compiler Docs folder which lists all of the redistributable files.
By default, when you build in Visual Studio, the option "Disable Default Library Search Rules" is set to Yes. You should change this to No (under Libraries.) Build your library in a Release configuration.
Now open a Fortran Build Environment command window, set default (cd) to the folder containing one of the .obj files from your library and type the command:
dumpbin -directives filename.obj
where "filename.obj" is the name of the object file. You will see output that looks like this:
Dump of file t.obj
File Type: COFF OBJECT
Linker Directives
-----------------
-defaultlib:ifconsol
-defaultlib:libifcore
-defaultlib:libifport
-defaultlib:libm
-defaultlib:LIBC
-defaultlib:libirc
-defaultlib:OLDNAMES
The list will be repeated twice. Find all the names listed here that are in the Fortran compiler's /Lib folder and include those with your library. Instuct the user to add the folder containing these libraries to the library search path.
Note that you may run into difficulties with Visual C++ such as: 1) VC2005 does not provide libc, so you need to build your library specifying the "Multithreaded" libraries at least, 2) unlike Fortran, a library built for one library style (static vs. DLL, multithread vs. single-thread) can't be used with other library styles.
Make sure you test thoroughly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you got it wrong. A static library is no more than a collection of the .obj files with NO external references resolved. To use it, you need to also have available, at link time, objects or libraries which satisfy any external references made from within the library. In the case of Fortran code, this usually means the compiler-supplied run-time libraries.
You may be thinking of "static linking" where you tell the linker to build everything into the executable and not rely on DLLs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Thank you very much for the great information! This will help us a lot.
- Steve

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