Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
27153 Discussions

Silly question: Windows equivalent of -B -L -l

Germán
New Contributor I
287 Views

Well, here is a super silly question...

I brought my make files from Linux over to Windows just to discover that options

-L that I use to indicate a directory where to look for my libraries
-l that I use to specify a given library
-B that I use to pick between dynamic or static version of my library

are not accepted by Intel on Windows

I browsed the documentation and did not find a quick answer. The alphabetical index of options just says that the above options are not available on Windows but it does not say what to do, instead...that would be a great place to put that information.

How do I accomplish the same goal?

Thanks,

0 Kudos
4 Replies
Arjen_Markus
Valued Contributor III
282 Views

On Windows the Intel compiler conforms more or less to what is usual on that platform. That said, there is no convention that a library has a name "libsomething.a" and that its directory can be specified via a flag -L. The easiest way threfore is to specify the complete name and the path.

As for static versus dynamic, again you will have to do that explicitly. Small complication: on Windows you are dealing with dynamic link libraries (.dll) and their companions, import libraries, extension .lib. If you use the MS Visual Studion environment and similar that sort of things is taken care of for you, but you are our on your own otherwise.

mecej4
Black Belt
278 Views

Instead of -L followed by a list of directories, set the environment variable LIB to a list of directories that are to searched for .lib files.

Instead of -l followed by a part of the library name, specify the name of the library file. The compiler driver will recognize that a .lib file does not need compilation, and will pass the name to the linker. You can also set the environment variable LINK to a list of library names and linker options, and thereby avoid specifying those library names and options explicitly in the linking command.

The compiler provides the options /libs:static and /libs:dll . Similarly, the old style options /MT and /MD can be used.

Germán
New Contributor I
259 Views


Aaahhh...so no convention on lib-prefixed/.a-suffixed library names...Got it.

For as long as the Intel setvars.bat file has already set variables INCLUDE and LIB, they are inherited into the make file from the environment and, thus, I would hate to modify them, even if in actuality it is in some kind of sub-shell.

Anyway, I tried a few combinations of my existing compiling/linking flags and found out that the easiest thing to do is to pass the libraries with full path.

So, I am good; but I have a couple of additional questions.

In regards to setting LINK, can you provide an example of what it would look like?

Also, I tried using /link but the compiler does not recognize it or, again, I don't know what to pass right after it. Can you provide an example of what it would look like? Maybe the equivalent of the example for LINK.

Thanks,

mecej4
Black Belt
254 Views

You can append your additional library names to LIB using the SET command, and the modification to the environment variable will be in effect until you close that command window. Similarly for other environment variables such as INCLUDE and PATH.

Suppose you wanted to link to the library MKL_RT.LIB and obtain a map file. You could use the command 

 

ifort prgma.f90 mkl_rt.lib /link /map

 

You could, instead, do

 

set LINK=/map mkl_rt.lib

 

at the beginning of the session. That having been done, the command 

 

ifort prgma.f90

 

will have the same effect as the longer compilation command shown above. See the MS documentation on LINK.

Reply