Node:The Foreign Resource Linker, Next:Init and Deinit Functions, Previous:Interface Predicates, Up:Calling C
The foreign resource linker, splfr
, is used for creating foreign
resources (see Foreign Resources). splfr
reads terms from a
Prolog file, applying op declarations and extracting any
foreign_resource/2
fact with first argument matching the resource
name and all foreign/[2,3]
facts. Based on this information, it
generates the necessary glue code, and combines it with any additional C
or object files provided by the user into a linked foreign resource.
The output file name will be the resource name with a suitable extension.
splfr
is invoked as
% splfr [ Option | InputFile ] ...
The input to splfr
can be divided into Options and
InputFiles and they can be arbitrarily mixed on the command
line. Anything not interpreted as an option will be interpreted as an
input file. Exactly one of the input files should be a Prolog file.
The following options are available:
--help
-v
--verbose
--version
--config=
ConfigFile
--cflag=
CFlag
-LD
--sicstus=
Executable
--with_jdk=
DIR
--with_tcltk=
DIR
--with_tcl=
DIR
--with_tk=
DIR
--with_bdb=
DIR
--keep
spld
tool. See The Application Builder, for details.
--resource=
ResourceName
-o, --output=
OutputFileName
.so
on
most UNIX dialects, .dll
under Windows). The use of this option
is discouraged, except to change the output directory.
--manual
-S
--static
spld
tool, The Application Builder.
--no-rpath
-R
path
for each
-L
path
. The --no-rpath
option inihibits this.
--nocompile
--keep
.
--namebase=
namebase
--resource
). If --static
is specified, the default
namebase is the resource name followed by _s
.
--header=
headername
namebase_glue.h
.
All C files that define foreign functions or that call SICStus API
functions should include this file. Among other things the generated
header file includes prototypes corresponding to the foreign/3
declarations in the prolog code.
--multi-sp-aware
--exclusive-access
--context-hook=
name
--no-context-hook
--moveable
On platforms that support it, i.e. some versions of UNIX, the default
behavior of splfr
is to add each directory dir specified
with -L
dir to the search path used by the run-time loader
(using the SysV
ld -R
option or similar). The option
--moveable
turns off this behavior. For additional details, see
the corresponding option to spld
(see The Application Builder).
The key input to splfr
is the SourceFile. The contents of
this file determines how the foreign resource's interface will look
like. When the source-file is read in, foreign_resource/2
facts
with first argument matching the name of this resource
(i.e. ResourceName
) is extracted together with all
foreign/[2,3]
facts.