- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The documentation about static library say
"If you use a static library, only those routines actually needed by the program are incorporated into the executable image (.EXE
Is there any option to skip this behavior and include all the routines in the executable image. Consider the scenario with Visual Studio 2015 and Intel Fortran Composer 2016
- Fortran static lib expose routines to C/C++ using !DEC$ ATTRIBUTES DLLEXPORT
- C++ executable link the static lib. The exe shall have all the exposed routines including the unreferenced routines.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why would you want to do it, and generate EXEs and DLLs of enormous size, which would consist for the most part of useless code, and whose generation would take the linker much time, and the loading of which would be much slower? What gains do you expect?
Currently, the way linkers usually work is that the smallest indivisible unit of inclusion is an OBJ file, not an individual routine, and if one of the external symbols in an OBJ is required, all the routines in the OBJ will be included. You are asking for a way of making the entire LIB file the smallest indivisible unit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Mecej4 for the quick reply. Your concerns for the size is genuine and thanks for considering that.
My scenario is a bit complex and involves multiple C++ & Fortran dlls, static libs and executables. I will try to add simplified scenario later some time, and attach some code as well.
If there is any settings that can disable the default behavior, that would be great.
Currently, I have created wrappers for all exposed routines in a single file with a dummy routine and call the dummy routine from C++ executable, in order to load all exposed routines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no setting to have the linker include unreferenced objects from a library. As @mecej4 says, you could use a single .obj file, or even extract all the objects from a library to a single .obj. What I am not seeing, though, is why you want to do this - how do you intend to "see" the unreferenced routines?

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