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

C program linked with Fortran library

weichao
Beginner
553 Views
I have three projects:
Project A (A.lib) : Fortran library (BLAS routines)
Project B (B.lib) : C library (CBLAS routines)
Project C (C.exe) : main program in C
B.lib links with A.lib. The main program C.exe links with B.lib.
When I built C.exe, VC.Net told me it neededsome Intel Fortran libraries:
ifconsol.lib
libifcore.lib
libifport.lib
libirc.lib
libm.lib
If Iset thepath of Intel Fortran libraryinVS.NET, it will work fine.
How can I build C program withoutIntel Fortranlibraries?
weichao
0 Kudos
3 Replies
Steven_L_Intel1
Employee
553 Views
B isn't linked with anything - it isn't linked. All the linking occurs when the EXE is built. The Fortran code in A needs the Fortran libraries and if routines in A are called, directly or indirectly, you need the Fortran libraries when building C.exe.
0 Kudos
weichao
Beginner
553 Views
B.lib will be linked with A.lib if I define the library A.lib in Project->Properties->Librarian->General->Addional dependencies. In project C, only B.lib is defined and I don't need to tell VC anything about A.lib.
0 Kudos
Steven_L_Intel1
Employee
553 Views
That is not the way it works. A .LIB is not linked. What you have done with the project dependencies is tell VS.NET to include the libraries of all the dependent projects, even dependents of dependents, when the executable is linked. So even though you don't tell project C about A, you did tell it about B which knows about A. That establishes the dependence chain. You can see this if you look at the build output log.
0 Kudos
Reply