Cross-platform support for dynamically loadable libraries

The Dynlibs unit provides support for dynamically loading shared libraries. It is available only on those platforms that support shared libraries. The functionality available here may only be a part of the functionality available on each separate platform, in the interest of portability.

On unix platforms, using this unit will cause the program to be linked to the C library, as most shared libraries are implemented in C and the dynamical linker too.

Library handle type
TLibHandle
should be considered an opaque type. It is defined differently on various platforms. The definition shown here depends on the platform for which the documentation was generated.
Correctly typed Nil handle - returned on error by
Load a dynamic library and return a handle to it.

LoadLibrary loads a dynamic library in file Name and returns a handle to it. If the library cannot be loaded, is returned.

No assumptions should be made about the location of the loaded library if a relative pathname is specified. The behaviour is dependent on the platform. Therefore it is best to specify an absolute pathname if possible.

On error, is returned.
Get the address of a procedure or symbol in a dynamic library.

GetProcedureAddress returns a pointer to the location in memory of the symbol ProcName in the dynamically loaded library specified by it's handle lib. If the symbol cannot be found or the handle is invalid, Nil is returned.

On Windows, only an exported procedure or function can be searched this way. On Unix platforms the location of any exported symbol can be retrieved this way.

If the symbol cannot be found, Nil is returned.
Unload a previously loaded library
UnloadLibrary
unloads a previously loaded library (specified by the handle lib). The call returns True if succesful, False otherwisa.
On error, False is returned.
For compatibility with Delphi/Windows: Unload a library
FreeLibrary
provides the same functionality as , and is provided for compatibility with Delphi.
For compatibility with Delphi/Windows: Get the address of a procedure
GetProcAddress
provides the same functionality as , and is provided for compatibility with Delphi.