NextPrevUpTopContentsIndex

process-foreign-code

Macro
Summary

Allows C code to be included in a Lisp fasl file.

Package

foreign-parser

Syntax

process-foreign-code c-string &key language control =>

Arguments

c-string

A string.

language

One of :c or :ansi-c .

control

One of :fasl , :object or :source .

Description

c-string is a string containing C source code.

language is :c by default.

control defaults to :fasl . If the value is :fasl , the C code is compiled at Lisp compile-file time into a temporary .o file. The resulting object module is stored in the fasl file. If the value is :object , the C code is compiled at compile-file time into a .o file with the same name as the Lisp source file, and loaded when the fasl file is loaded. If the value is :source , compilation and loading of the C code is done when the fasl file is loaded.

Example
(process-foreign-code "int sum (int a, int b) 
                      { return a+b; }")
; When the lisp file containing this statement is 
; loaded, the c-code is compiled and also loaded into 
; the image. 
Note

The Foreign Parser is loaded by:

(require "foreign-parser")
See Also

link-load:read-foreign-modules in the LispWorks Reference Manual and the Foreign Parser chapter in the LispWorks Foreign Language Interface User Guide and Reference Manual


LispWorks for UNIX Supplementary Manual - 11 Apr 2005

NextPrevUpTopContentsIndex