When using CFX 11.0 on Linux/UNIX systems, is it possible to link in extra libraries with user Fortran libraries (e.g. maths libraries)?




This is indeed possible, but first a word of warning: If extra libraries are to be linked in this way, it is important that they are object code compatible with the user Fortran shared library. If possible, compile everything from source as the same compiler and compiler options are then used throughout, which is less error prone.

First, consider the creation of a user Fortran library without linking any extra libraries, for which a command similar to that shown below would normally be used. This example would create a shared library called 'library1.so' from the source files file1.F file2.F and file3.F.

cfx5mkext -name library1 file1.F file2.F file3.F


If the routines in these files need to call some library functions (for example in libmaths1.a and libmaths2.a), then the library can be linked as follows:

cfx5mkext -name library1 file1.F file2.F file3.F libmaths1.a libmaths2.a

If the libmaths1.a libmaths2.a are not in the current working directory, then an abolute or relative path may be specified instead.


Another, more flexible way of achieving the same result would be to use the -L option. This allows the path to the library files to be specified (in this example /home/fred/lib):

cfx5mkext -L/home/fred/lib -name library1 -name library1 file1.F file2.F file3.F -lmaths1 -lmaths2

(Note that there may be more than one instance of -L and that -I can be used in the same way if the #include path needs to be appended to. Also, if it is required to link to system libraries, these can be linked in the same way. e.g. for the gzip library libgz.a, it would be necessary to add -lgz to the command line. The path to system libraries is usually added automatically by cfx5mkext and does not need to be added using the -L option.)
**** Entered By: dsclarke @ 01/04/2009 09:11 PM ****





Show Form
No comments yet. Be the first to add a comment!