The CATALOG command is provided as a front end program to convert object files generated by the BASIC command into main program executables and shared libraries/DLLs of subroutines.
CATALOG -Llib -obin -v -cExternalCLibs BP PROGRAM1 SUB1
Where options are:
Main program executables by default are copied in the home directory "bin" directory. Subroutine object files are collated into evenly sized shared libraries and then by default placed in the home directory "lib" directory.
In order to be able to rebuild a shared library the object file is retained in the "objdir" subdirectory of the "lib" directory. These object files are no longer required once all the shared libraries have been debugged and ready to release.
The CATALOG command invokes the jBASE jBuildSLib command with the subroutine object file to construct the shared libraries. The jBuildSLib command then links several object files together with relevant references to other required libraries and creates a shared library/DD.
It should be noted that every time a subroutine is cataloged, jBuildSLib is invoked to rebuild the shared library/DLL. However when the CATALOG command is issued with an active select list of program names, the rebuilding (i.e. jBuildSLib) is deferred until the list has been fully processed. This means that each shared object/DLL is only rebuilt once, as opposed to once for each subroutine. So when cataloging subroutines, it is much faster to work from an active select list. The same is true when decataloging subroutines.
To force the CATALOG command to place executables and shared libraries in alternative directories to the "bin" and "lib" directory in the current home directory, the following environment variables can be set.
To redirect main executables use:
To redirect subroutine shared libraries use:
To link with external C function libraries:
Programmers should be aware that by convention jBC program names have an extension of ".b" (and also ".B" on Windows). The jbc command expects programs specified as "name.b". The BASIC and CATALOG commands do not require programs to have a .b extension because they add one when necessary. This can be seen when the verbose option is used on BASIC and CATALOG. If a main program has a .b extension, it is dropped when the program is cataloged. For example, if the name of the program is CUSTMAINT.b, the resulting executable created by CATALOG is called CUSTMAINT. If a subroutine has a .b extension, then it's internal name should not have the extension:
In this instance the subroutine would be called as:
The jLibDefinition file is used by default to configure the size and naming convention for each shared library. If the "lib" directory already exists then the jLibDefinition file is read from the "lib" directory. If this is the first time the "lib" directory is created then the jLibDefinition file is read from the "config" subdirectory of the jBASE release directory.
The configuration options contained in the jLibDefinition file are as follows:
%n - Use sequence number from 0 upwards
e.g. a "libname" definition of lib%a%n.so would result in libraries named as