Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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