Next Previous Up Top Contents Index

11 The LINK-LOAD Package

process-foreign-file

Function

Package

link-load

Syntax

process-foreign-file files &key dff language preprocess preprocessor preprocessor-options virtual-functions accessors case-sensitive c-code-control resolve-errors =>

Arguments

files

One or more filenames.

dff

A filename.

language

One of:c++,:g++,:arm, or:any-c++.

preprocess

A boolean.

preprocessor

A string.

preprocessor-options

A string.

virtual-functions

A boolean.

accessors

A boolean.

case-sensitive

See description.

c-code-control

One of:fasl,:object, or:source.

resolve-errors

A boolean.

Description

Theprocess-foreign-file function takes a file or files of foreign declarations -- usually header files -- and parses them, producing 'dff' files of Lisp calls todefine-foreign-function,define-foreign-variable,define-foreign-type, and so on, that will, when compiled, produce a Lisp interface to the foreign code.
process-foreign-file will use a preprocessor program specified by the variablesystem::*preprocessor*. The default value is/lib/cpp.
files gives the name of the header files or file to be processed. The name of a file consists of source-file-name and source-file-type (typically.h).
dff is an output file which will contain the Lisp foreign function definitions. The default value isnil, in which case the dff file will be source-file-name-dff.lisp. (See files, above.)
language specifies the language the header files are written in. This may be one of:c++,:g++ (both GNUg++ compiler-compatible),:arm (ARM C++/AT&T/Lucid compatible),:c (standard C header files), and:any-c++ (any C++ variety). By default this is:any-c++.
preprocess, when non-nil, runs the preprocessor on the input files. The default value ist.
preprocessor is a string containing the pathname of the preprocessor program. By default this is the value ofccl:*preprocessor*.
preprocessor-options is a string containing command line options to be passed to the preprocessor if it is called. By default this is the value ofccl:*preprocessor-options*.
virtual-functions, when non-nil, will assume that all C++ member functions are virtual. This creates separate caller stubs for each function. You will need to set this tot if you want to interface to any form of virtual function. This option will also enable interfacing to inline functions. LispWorks does not attempt to interface to the internals of virtual method dispatching. By default this ist.
accessors, ift, ensures accessors are created for all class slots. Ifnil, neither reader nor writer functions are created. The default value ist.
case-sensitive specifies whether to maintain case sensitivity in symbol names as in the source files. Values can be:
  • t -- the names of all Lisp functions and classes created are of the form |name|.
  • nil -- all foreign names are converted to uppercase and an error is signalled if any name clashes occur as a result of this conversion. For example,OneTwoTHREE becomesONETWOTHREE.
  • :split-name -- attempts to split the name up into something sensible. For example,OneTwoTHREE becomesONE-TWO-THREE.
  • :prefix -- changes lowercase to uppercase and concatenates the string with the string held insys:*prefix-name-string*. For example,OneTwoTHREE becomesFOREIGN-ONETWOTHREE.
  • (list :user-routinefunction-name) -- enables you to pass your own function for name formatting. Your function must take a string argument and return a string result. It is not advised to use destructive functions (e.g.nreverse) as this may cause unusual side effects.
If case-sensitive takes any other value, names are not changed. The default value is*case-sensitive*.
c-code-control can be either:fasl,:object or:source.The default value is*c-code-control*. This control keyword is used when emitting theprocess-cpp-codedefinition.
resolve-errors, when non-nil, creates null structures for all undefined foreign datatypes. The default value isnil.
Example

(process-cpp-file "test.h" :accessors t :case-sensitive  nil)
; This creates the dff-file test-dff.lisp, which
; contains the necessary foreign definitions for 
; declaration in test.h.

(compile-file "test-dff" :load t) ;; compile and load test-dff.lisp

(read-foreign-modules "test.o") ;; load original object module

See Also

process-foreign-code
read-foreign-modules

LispWorks Reference Manual - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker