Module dynlib

This module implements the ability to access symbols from shared libraries. On POSIX this uses the dlsym mechanism, on Windows LoadLibrary.

Types

LibHandle = pointer
a handle to a dynamically loaded library   Source Edit

Procs

proc raiseInvalidLibrary(name: cstring) {.
noinline, noreturn, raises: [LibraryError], tags: []
.}
raises an EInvalidLibrary exception.   Source Edit
proc checkedSymAddr(lib: LibHandle; name: cstring): pointer {.
raises: [Exception, LibraryError], tags: [RootEffect]
.}
retrieves the address of a procedure/variable from lib. Raises EInvalidLibrary if the symbol could not be found.   Source Edit
proc loadLib(path: string; global_symbols = false): LibHandle {.
raises: [], tags: []
.}
loads a library from path. Returns nil if the library could not be loaded.   Source Edit
proc loadLib(): LibHandle {.
raises: [], tags: []
.}
gets the handle from the current executable. Returns nil if the library could not be loaded.   Source Edit
proc unloadLib(lib: LibHandle) {.
raises: [], tags: []
.}
unloads the library lib   Source Edit
proc symAddr(lib: LibHandle; name: cstring): pointer {.
raises: [], tags: []
.}
retrieves the address of a procedure/variable from lib. Returns nil if the symbol could not be found.   Source Edit