Intel® Fortran Compiler 18.0 Developer Guide and Reference

OBJCOMMENT

General Compiler Directive: Specifies a library search path in an object file.

!DIR$ OBJCOMMENT LIB: library

library

Is a character constant specifying the name and, if necessary, the path of the library that the linker is to search.

The linker searches for the library named in OBJCOMMENT as if you named it on the command line, that is, before default library searches. You can place multiple library search directives in the same source file. Each search directive appears in the object file in the order it is encountered in the source file.

If the OBJCOMMENT directive appears in the scope of a module, any program unit that uses the module also contains the directive, just as if the OBJCOMMENT directive appeared in the source file using the module.

If you want to have the OBJCOMMENT directive in a module, but do not want it in the program units that use the module, place the directive outside the module that is used.

Example

 !  MOD1.F90
 MODULE a
 !DIR$ OBJCOMMENT LIB: "opengl32.lib"
 END MODULE a

 !  MOD2.F90
 !DIR$ OBJCOMMENT LIB: "graftools.lib"
 MODULE b
 !
 END MODULE b

 !  USER.F90
 PROGRAM go
    USE a    ! library search contained in MODULE a
             !   included here
    USE b    ! library search not included
 END

See Also