"Dynamic-Loading of code modules"

dlfcn
This file exports a set of system words for
dynamic loading of code modules.
Tektronix CTE %derived_by: guidod % %version: bln_mpt1!2.21 % GNU LGPL
FORTH
* (LOADM) ( bstring -- sucess )

dlfcn ordinary primitive

* LOADM ( 'filename' -- )

dlmap the shared object (or share an already mapped object)
and run the per-thread initialization code. This is the
user-convenient function, otherwise use (LOADM)
 simulate:
   : LOADM  BL WORD   
     ((IS_MODULE_LOADED)) IF EXIT THEN 
     HERE (LOADM)  0= IF ." -- load failed: " HERE COUNT TYPE CR THEN ;

dlfcn ordinary primitive

* LOCAL-DLSYM ( [symbolname] -- address ) exec-only

lookup the symbol that follows and leave the address (or null)

dlfcn immediate primitive

FORTH LOCAL-DLCALL

no special info, see general notes

dlfcn immediate primitive

FORTH DLSYM

no special info, see general notes

dlfcn loader code P4_iOLD

FORTH DLCALL

no special info, see general notes

dlfcn loader code P4_iOLD

EXTENSIONS # if 0 && defined _target_os_linux && !defined __cplusplus
* accessing shared libraries - only available for i386-linux
EXTENSIONS CALL-C

no special info, see general notes

dlfcn ordinary primitive

# endif # ifdef PFE_HAVE_USELIB
EXTENSIONS USELIBRARY

no special info, see general notes

dlfcn ordinary primitive

# endif
* lt_dlinit ( -- ior )

initialiize library, usually open the program itself so that its
handles can be found under "0"

dlfcn ordinary primitive

* lt_dlopenext ( name-ptr,len -- handle-ptr|0 )

walk the searchpath for dlopen and try to open a binary module
under the given name with the usual file extension for the
current system.

dlfcn ordinary primitive

* lt_dlsym ( name-ptr,len handle -- symbol-addr|0)

try to find the name in the binary module denoted by its handle
.. if handle is null, use the main body of the program

dlfcn ordinary primitive

* lt_dlclose ( handle -- ior )

close handle that was returned by lt_dlopenext

dlfcn ordinary primitive

* lt_dlerror ( -- z-string* )

returns string describing the last dlerror as for lt_dlopenext
and lt_dlsym

dlfcn ordinary primitive