### 15.1.13 OBJCOMMENT Directive

The OBJCOMMENT directive specifies a library search path in an object file. This directive takes the following form: [See Note]

  cDEC$ OBJCOMMENT LIB:library
  c
  Is one of the following: C (or c), !, or * (see Section 15.1.1).
  library
  Is a character constant specifying the name and, if necessary, the path of the library that the linker is to search.

Rules and Behavior

The linker searches for the library named by the OBJCOMMENT directive 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.

Examples

Consider the following:

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

     ! MOD2.F90
     !DEC$ 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

  Note: The following form is also allowed: `!MS$OBJCOMMENT LIB:library`

For More Information:

For details on syntax rules for all general directives, see Section 15.1.1.

Previous Page Next Page Table of Contents