TLibFile - LIB File Reader

Source: source/classes/tlib.prg

TLibFile inherits from TFile and provides read-only access to OMF-format static library (.LIB) files. It parses the library directory pages to extract module names and metadata, allowing tools to inspect the contents of a library without an external librarian utility.

Inheritance

classDiagram TFile <|-- TLibFile class TLibFile { +nSignature() +nPageSize() +nDirPages() +aModules() }

Methods

MethodDescription
nSignature()Return the LIB signature word. Standard OMF libraries return 0xF0F0
nPageSize()Return the library page size in bytes (typically 256 or 512)
nDirPages()Return the number of directory pages in the library
aModules()Return an array of module names (OMF object files) contained in the library

Example: Inspect a Library File

#include "FiveWin.ch"

function Main()

   local oLib := TLibFile():New( "C:\fwteam\lib\FiveHC.lib", 0 )
   local aMods, n

   if oLib:hFile != nil
      ? "Signature:", oLib:nSignature()
      ? "Page size:", oLib:nPageSize()
      ? "Directory pages:", oLib:nDirPages()

      aMods := oLib:aModules()
      ? "Modules in library:", Len( aMods )

      for n := 1 to Min( Len( aMods ), 20 )
         ? n, aMods[ n ]
      next

      oLib:Close()
   else
      ? "Cannot open library file"
   endif

return nil

See Also