Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Use IPO on a static library

Allen_Barnett
Beginner
595 Views
Hi: We deliver our product as a static library. It's mostly written in FORTRAN with a thin C++ wrapper. It performs a complicated operation (basically solving a large system of equations) and consists of a several dozen source files. The interface visable to the end-user is essentially one function call. Some common functions appear in separate modules in separate source files and we would like to have the compiler inline them if it's appropriate. Is it possible to build our library as a plain static library which has all the suitable FORTRAN functions inlined? The result must be a plain static library which can be linked into a program.
Thanks,
Allen
0 Kudos
4 Replies
Steven_L_Intel1
Employee
595 Views
No, it can't do that. The actual optimization of an IPO build happens during the link step with the Intel compiler driver (or xilink) used to start the link. You could build a DLL this way.
0 Kudos
Allen_Barnett
Beginner
595 Views
Hi Steve: Thanks. That's what I figured.
Can you give me the correct arguments to the linker to produce a DLL with IPO? Is there anything special about using FORTRAN to build a DLL? Like $DEC directives for the exported symbols or special treatment of common blocks or similar? (I admit I'm lost in windows development subtleties.)
Thanks,
Allen
0 Kudos
Steven_L_Intel1
Employee
595 Views
In each routine you want exported, add:

!DEC$ ATTRIBUTES DLLEXPORT :: routinename

You could, as an alternative, create a .def file with the appropriate lines in it to name the routines you want exported. This is described in the documentation. The .def file is then included in the ifort command you use to link.

To link, use ifort /dll

you may want to add /libs:static to make sure there are no dependencies on other libraries.

The link will produce a .dll and a .lib. The end user links against the .lib, and the .dll has to be in PATH somewhere.
0 Kudos
Allen_Barnett
Beginner
595 Views
Thanks for the help!

(I should take typing lessons.)
0 Kudos
Reply