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

question about building LIB's

Brian_Murphy
New Contributor II
645 Views

If A.LIB calls routines in B.LIB, can A.LIB be built before B.LIB has been built?

The reason I'm asking this is for times when I'm not sure if A.LIB is actually calling any routines in B.LIB.  If B.LIB is being called, but I don't have it, will I get unresolved externals when building A.LIB or when building the final main program that pulls everything together?

0 Kudos
5 Replies
Steven_L_Intel1
Employee
645 Views

No, you won't get ANY unresolved externals when building a static library. All that resolving happens at link time.

0 Kudos
mecej4
Honored Contributor III
645 Views

Think about this point: when you compile and link any Fortran program, your sources get compiled into *.OBJ files which are then linked to the libraries that came with the compiler. Those libraries could have been built weeks/months/years before your own object and library files were created.

For the whole build system to work, there can be no required temporal precedence rules that govern the files that are presented to the linker, other than the requirement that all of them should exist before the linker is asked to build the EXE or DLL that you request.

0 Kudos
Brian_Murphy
New Contributor II
645 Views

Thanks, Steve.  That's exactly what I want to find out.

I will soon be taking my first steps into using Intel's MKL to utilize its Lapack routines.

0 Kudos
Brian_Murphy
New Contributor II
645 Views

mecej4 - My knowledge of the overall build process is skimpy.  I wasn't sure if building A.LIB was itself a linking process that required B.LIB.

Is it correct that a .LIB file made from fifty .obj files is just a simple container for the fifty .obj files?  I suppose mainly for convenience purposes.

0 Kudos
Steven_L_Intel1
Employee
645 Views

Yes, that's really all it is. (Unless you build those .OBJs into a DLL in which case the .LIB is an "import library" that serves to connect DLLEXPORTed names to locations in the DLL.)

0 Kudos
Reply