All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 5 Advanced Uses of the FLI

NextPrevUpTopContentsIndex

5.6 Incorporating a foreign module into a LispWorks image

Embedded dynamic modules are dynamically loaded foreign modules which are embedded (that is, the data is stored inside the LispWorks image). They can then be used at run time.

The formats supported include DLL on Windows, dylib on Mac OS X, and shared object or shared library on other platforms. See Loading foreign code for details of the types of modules supported.

You use an embedded dynamic module when you want to integrate foreign code, and that foreign code is not expected to be available on the end-user's computer. In principle this could also be achieved by supplying the foreign module as a separate file together with the Lisp image, locating it at run time and loading it with register-module. The embedded dynamic modules mechanism simplifies this.

The main interface is get-embedded-module, which is called at load time to "intern" the module, and install-embedded-module which needs to be called at run time to make the foreign code available. It is possible to incorporate in a fasl file by using get-embedded-module-data and setup-embedded-module instead of get-embedded-module.

Another way to "intern" the module is to define a lw:defsystem system containing a C source file member with the :embedded-module keyword. When the system is loaded, the value associated with :embedded-module is used to create the embedded module. You would then call install-embedded-module at run time to make the foreign code available.


LispWorks Foreign Language Interface User Guide and Reference Manual - 29 Sep 2017

NextPrevUpTopContentsIndex