- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a number of routines and functions I frequently use in my programs. In order to be able to access them without actually having to include them in each individual program's source code I tried creating a module library with these program units in it.
I compiled my library using
$ ifort -shared -o mylib.so mylib.f90
With Intel Fortran 8 / Linux.
I then copied the .so file to the compiler's lib directory and the .mod to the include directory.
When trying to compile a program with "USE mylib" in it I get a bunch of errors basically telling me that the module file is detected, but not the library. I also tried the
-LDir option to tell the compiler where the library was - but to no avail.
I did the same thing using Intel Visual Fortran 8 / Windows recently. There, I started a static library project and included the following line at the top of the file:
!DEC$ OBJCOMMENT LIB:"mylib.lib"
telling the compiler where the library file is. That works fine.
This command doesn't seem to work with Ifort Linux though.
Any ideas as to how I can
a) bundle my program units in a universally accessible
library, or
b) at least tell the compiler where the library to be
used resides
would be much appreciated.
Thanks,
Jan
I compiled my library using
$ ifort -shared -o mylib.so mylib.f90
With Intel Fortran 8 / Linux.
I then copied the .so file to the compiler's lib directory and the .mod to the include directory.
When trying to compile a program with "USE mylib" in it I get a bunch of errors basically telling me that the module file is detected, but not the library. I also tried the
-LDir option to tell the compiler where the library was - but to no avail.
I did the same thing using Intel Visual Fortran 8 / Windows recently. There, I started a static library project and included the following line at the top of the file:
!DEC$ OBJCOMMENT LIB:"mylib.lib"
telling the compiler where the library file is. That works fine.
This command doesn't seem to work with Ifort Linux though.
Any ideas as to how I can
a) bundle my program units in a universally accessible
library, or
b) at least tell the compiler where the library to be
used resides
would be much appreciated.
Thanks,
Jan
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As you note, the !DEC$ OBJCOMMENT directive is not supported on Linux. I will suggest that the compiler issue a diagnostic for this.
I think you have to name the library when you build the application. I don't know of any way to have this done implicitly. Note that the compiler libraries are added by the ifort driver automatically.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page