Dynamic libraries
=================

The following routines are supplied to help load and inspect dynamic libraries.  They should be used in place of the traditional dlopen, dlclose, and dlsym functions, which are not portable across operating systems.

You must include <jit/jit-dynamic.h> to use these routines, and then link with -ljitdynamic -ljit.

 -- Function: jit_dynlib_handle_t jit_dynlib_open (const char *NAME)
     Opens the dynamic library called NAME, returning a handle for it.

 -- Function: void jit_dynlib_close (jit_dynlib_handle_t HANDLE)
     Close a dynamic library.

 -- Function: void * jit_dynlib_get_symbol (jit_dynlib_handle_t HANDLE, const char *SYMBOL)
     Retrieve the symbol SYMBOL from the specified dynamic library. Returns NULL if the symbol could not be found.  This will try both non-prefixed and underscore-prefixed forms of SYMBOL on platforms where it makes sense to do so, so there is no need for the caller to perform prefixing.

 -- Function: void jit_dynlib_set_debug (int FLAG)
     Enable or disable additional debug messages to stderr.  Debugging is disabled by default.  Normally the dynamic library routines will silently report errors via NULL return values, leaving reporting up to the caller. However, it can be useful to turn on additional diagnostics when tracking down problems with dynamic loading.

 -- Function: const char * jit_dynlib_get_suffix (void)
     Get the preferred dynamic library suffix for this platform. Usually something like so, dll, or dylib.