<html lang="en"> <head> <title>Loading Shared Object Files - SBCL 1.0.31 User Manual</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="SBCL 1.0.31 User Manual"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Foreign-Function-Interface.html#Foreign-Function-Interface" title="Foreign Function Interface"> <link rel="prev" href="Foreign-Data-Structure-Examples.html#Foreign-Data-Structure-Examples" title="Foreign Data Structure Examples"> <link rel="next" href="Foreign-Function-Calls.html#Foreign-Function-Calls" title="Foreign Function Calls"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual is part of the SBCL software system. See the `README' file for more information. This manual is largely derived from the manual for the CMUCL system, which was produced at Carnegie Mellon University and later released into the public domain. This manual is in the public domain and is provided with absolutely no warranty. See the `COPYING' and `CREDITS' files for more information. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Loading-Shared-Object-Files"></a> <p> Next: <a rel="next" accesskey="n" href="Foreign-Function-Calls.html#Foreign-Function-Calls">Foreign Function Calls</a>, Previous: <a rel="previous" accesskey="p" href="Foreign-Data-Structure-Examples.html#Foreign-Data-Structure-Examples">Foreign Data Structure Examples</a>, Up: <a rel="up" accesskey="u" href="Foreign-Function-Interface.html#Foreign-Function-Interface">Foreign Function Interface</a> <hr> </div> <!-- node-name, next, previous, up --> <h3 class="section">8.6 Loading Shared Object Files</h3> <p>Foreign object files can be loaded into the running Lisp process by calling <code>load-shared-object</code>. <p><a name="Function-sb_002dalien_003aload_002dshared_002dobject"></a> <div class="defun"> — Function: <b>sb-alien:load-shared-object</b><var> pathname &key dont-save<a name="index-sb_002dalien_003aload_002dshared_002dobject-298"></a></var><br> <blockquote><p><a name="index-sb_002dalien_003aload_002dshared_002dobject-299"></a>Load a shared library / dynamic shared object file / similar foreign container specified by designated <code>pathname</code>, such as a .so on an <code>elf</code> platform. <p>Locating the shared object follows standard rules of the platform, consult the manual page for dlopen(3) for details. Typically paths speficied by environment variables such as LD_LIBRARY_PATH are searched if the <code>pathname</code> has no directory, but on some systems (eg. Mac <code>os</code> X) search may happen even if <code>pathname</code> is absolute. (On Windows LoadLibrary is used instead of dlopen(3).) <p>On non-Windows platoforms calling <code>load-shared-object</code> again with an <code>pathname</code> <code>equal</code> to the designated pathname of a previous call will replace the old definitions; if a symbol was previously referenced thru the object and is not present in the reloaded version an error will be signalled. Reloading may not work as expected if user or library-code has called dlopen(3) on the same shared object. <p><code>load-shared-object</code> interacts with <code>sb-ext:save-lisp-and-die:</code> <p>1. If <code>dont-save</code> is true (default is NIL), the shared object will be dropped when <code>save-lisp-and-die</code> is called <code>--</code> otherwise shared objects are reloaded automatically when a saved core starts up. Specifying <code>dont-save</code> can be useful when the location of the shared object on startup is uncertain. <p>2. On most platforms references in compiled code to foreign symbols in shared objects (such as those generated by DEFINE-ALIEN-ROUTINE) remain valid across <code>save-lisp-and-die</code>. On those platforms where this is not supported, a <code>warning</code> will be signalled when the core is saved <code>--</code> this is orthogonal from <code>dont-save</code>. </p></blockquote></div> </body></html>