Using third party libraries supplied in OBJ or LIB form

If you are programming for Win32 or Win16 you should link toexternal code via a DLL. This eliminates all of the potential headaches of interfacingwith external systems.

Linking an external OBJ file

The environment is only able to link in external LIB files, thereforeif you are supplied with an OBJ file you should use the object librarian to convertthe OBJ to LIB format. If you have multiple external object files to link you canput all of them into a single object library for convenience. This is possible becauseobjects are linked from object libraries only when explicitly used.

If the OBJ file is name MyObj.OBJ then use the following commandline for the object librarian.

sblib [ options ] MyObj MyObj.obj

This will create an object library file named MyObj.LIB.

Note: For Win32 we only support linking COFF object files.For Linux and Solaris, ELF object files. For all other systems the OMF object fileformat is used. Also some C compilers may use some object file features, or extensions,which our linker does not support. In these cases you will have to use a linker otherthan ours. Most likely the linker that comes with the operating system or C compiler.

Linking an external LIB file

If you are provided with a library file which contains executablecode or the library file simply provides linker resolution for a DLL that you areusing you should add a LIBNEEDED compiler directiveto the implementation of the module containing the declarations interfacing tothe external code. For foreign modules you only have a interface module, so you shouldput the directive there.

The object library file is found by setting up the LIB/SO directoryoption. If a source file has more than one LIBNEEDED directive then the librarieswill be linked in the order of directives in the source file.

Note: VC++ version 6 has an extended LIB file format which our linker does not support. To use one of the LIB files with our linker you will have to convert the file to a compatible format. The Microsoft LIB utility that comes with VC++ can do this for you. The LIB utility command switch to do this is /CONVERT. Also VC++ tends to always put some form of its debug information into its LIB files and this will need to removed. Use the command line StripDebug utility program installed with our compiler to remove the debug information from the LIB file.