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

Building a Library with VS2019 ("C" and FORTRAN")

Rodrigues__Pedro
Beginner
1,086 Views

Hello,

     I am trying to build some libraries of a project named SUNDIALs. I was able to do that under Linux, but with VS2019 and oneAPI under WIN10 I couldn't:

 - I used cmake to generate the project;

 - I opened the projects with VS and tried to build it;

 - "C" libraries were built successfully; 

 - FORTRAN libraries weren't build because the projects don't create the object FORTRAN files just "C" object files (the project uses "C" compiler but also has FORTRAN files in it to be used as object files on FORTRAN library projects);

  -  some projects must create wrappers to be used under FORTRAN;

thanks in advance

 

Pedro R.

 

  

   

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
1,065 Views

The way you do this in Visual Studio is to have two static library projects in one solution, one Fortran and one C. Use Build Dependencies > Project Dependencies to make the C project a "dependent" of the Fortran project.  In the Fortran project's properties, set property Librarian > General > Link Library Dependencies to Yes.

What will happen is that the C and Fortran code will be built separately, and then the C library modules will be inserted automatically into the Fortran library, giving you a combined library.

0 Kudos
Reply