next up previous
Next: Using the library Up: Foreign Language Interface Previous: Portability Note

Dynamic Linking of shared libraries

The interface defined in this section allows the user to load shared libraries (.so files on most Unix systems). This interface is portable to all machines providing the function dlopen(), normally from the library -ldl. To enable it, SWI-Prolog must be configured using

% sh configure --enable-dlopen
These functions provide the basic interface layer. It is adviced to use the predicates from section gif in your application.

open_shared_object( +File, -Handle)

  File is the name of a .so file (see your C programmers documentation on how to create a .so file). This file is attached to the current process and Handle is unified with a handle to the shared object.
close_shared_object( +Handle)

  Detach the shared object identified by Handle.
call_shared_object_function( +Handle, +Function)

  Call the named function in the loaded shared library. The function is called without arguments and the return-value is ignored. Normally this function installs foreign language predicates using calls to PL_register_foreign().



Passani Luca
Tue Nov 14 08:58:33 MET 1995