How are the Clarion .lib files structured?

Just as the title suggest, how are Clarion’s .lib files structered?

I get that it’s different from MSVC generated .lib files, but in what way?

I am asking this as I am looking to expand the DNNE library for C# with the functionality to generate the needed files for Clarion - already got the .clw and .inc working - only part missing is the .lib file to link everything together - sadly LibMaker doesn’t (at least by default) support command line as far as I can see. So I want to transfer this logic into C# instead and generate it there as I already have a list of the methods and their signatures etc (needed for the .clw and .inc).

I tried looking at the source of LibMaker itself, but not getting any wiser about the specs of the format.

LIB files can be used for 2 generally different purposes:

  • to be a container for set of object files which are result of compilation of source files
  • to give information to the linker about symbols exported from DLLs

LIB files can be of different formats. CW uses LIB and OBJ files of the OMF format. Another format of LIB files in Windows world is COFF/PE which is more wide using now. VS produces LIB files of the COFF/PE format, for C# in that number.

LibMaker handles LIB files of both kinds having the OMF format only. There converters from the OMF to COFF/PE format.

Sadly one cannot use the LIB file with COFF/PE format in Clarion - Clarion uses the OMF and OMF format only - but good to know it’s a general format, not a custom one…

Got it generating the LIB file, sadly CW doesn’t recognize it yet as it differs a little bit and can’t figure out why yet

My Libmaker has command line control
ClarionCommunity/MGLibMkr.clw at master · MarkGoldberg/ClarionCommunity (github.com)

I don’t think the @CarlBarnes version of the libmaker supports command line, but it would be an easy addition.
CarlTBarnes/LibMakerPlus: LibMaker Plus was made for CIDC 2019. It started as MG LibMaker and I added many features (github.com)

The LibMaker can convert .LIB from COFF to OMF

1 Like

COFF file specs.

These are 3 different OMF format specifications. I am not sure if clarion complies with one of them. Many years ago I made a parser of clarion OMF objects as a tool with the final intent of convert objects for linking into a clarion program.

Thanks for that, I’ve downloaded copies.

If you are still interested in lib files,I would suggest you take a look to Objconv. It is a utility for facilitating cross-platform development of function libraries, for
converting and disassembling object files, and for other development purposes. The latest version of objconv is available at Software optimization resources. C++ and assembly. Windows, Linux, BSD, Mac OS X.
Objconv can perform the following tasks:
Convert object files between different formats used on different x86 and x86-64
platforms.
Change symbol names in object files.
Build, manage and convert static link libraries in various formats for different x86 and x86-64 platforms (OMF included).
Dump file headers and other contents of object files, static and dynamic library files, and executable files.
Disassemble object files and executable files and check instruction code syntax.
It came with source code.