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

lib file not generated, resulting in cannot link it to other exe

Ngu_Soon_Hui
Beginner
584 Views

Hello, I have two vfproj. One is for ARPACK_win32, another is sssimp. These two projects are attached here.

sssimp is an exe, which makes use of ARPACK_win32 as base library.

In order for sssimp to make use of arpack_win32, I must be able to produce the arpack_win32.lib. However, I can only produce arpack_win32.dll ( you can verify this by compiling the arpack_win32.vfpoj). I couldn't tune the setting in arpack_win32.vfproj in order to produce a arpack_win32.lib.

Is there anything I did wrong?

More generally, how to make the below sln file produced an exe that works?

0 Kudos
3 Replies
Steven_L_Intel1
Employee
584 Views

In order for the DLL build to create an export library, you need to have

!DEC$ ATTRIBUTES DLLEXPORT :: name

directives in each routine you want to export. An alternative is to create a .DEF file with the exports named and add it to the project.

Do you really need this as a DLL? I'd think a static library would do and it would save you the export work.

0 Kudos
Ngu_Soon_Hui
Beginner
584 Views

Hi,

I think I need the DLL for redistribution purpose, and a static library (.lib) for linking purpose. The reason why I create a DLL now is because that's the only thing I know how to do in Intel Visual Fortran.

I can't seem to generate a static library, the samples provided don't seem to have that example, any pointers or ideas?

0 Kudos
Steven_L_Intel1
Employee
584 Views

There are two kinds of .lib - a static library, which contains code and is self-sufficient, and an export library which contains only the information needed to link with a DLL.

To create a static library, choose Library > Static Library when creating the new project. Add your sources to it and build.

Since your executable is in the same solution (which is good), you should right click in the executable project, select Dependencies, and check the box to make the library project a dependent of the executable project. This will make the library automatically link with the executable.

If you link with a static library you will not need to redistribute anything other than your EXE.

0 Kudos
Reply