Node:Using Library, Previous:Building Library, Up:Multiple Sources



Using Library

You can use a shared library by linking it with your main program.

Before linking the library, install it in your system library directory:

     $ cp libsubrs.so /usr/lib
     
or install it somewhere else and set LD_LIBRARY_PATH:
     $ cp libsubrs.so /your/cobol/lib
     $ export LD_LIBRARY_PATH=/your/cobol/lib
     

Then, compile the main program, linking the library as follows:

     $ cobc main.cob -L/your/cobol/lib -lsubrs