Debian Codegraph @

src/doc/old-manual/uffi/ref_func_libr.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book [
3 <!ENTITY % eclent SYSTEM "../ecl.ent">
4 %eclent;
5 ]>
6 <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
7 <reference xml:id="uffi.func_libr">
8 <title>Functions &amp; Libraries</title>
9
10 <refentry xml:id="uffi.def-function">
11 <refnamediv>
12 <refname><function>def-function</function></refname>
13 <refpurpose>Declares a function.
14 </refpurpose>
15 </refnamediv>
16 <refsynopsisdiv>
17 <title>Macro</title>
18 <synopsis>
19 <function>def-function</function> <replaceable>name args &amp;key module returning</replaceable>
20 </synopsis>
21 <variablelist>
22 <varlistentry>
23 <term><parameter>name</parameter></term>
24 <listitem>
25 <para>A string or list specificying the function name. If it is a string, that names the foreign function. A Lisp name is created by translating #\_ to #\- and by converting to upper-case in case-insensitive Lisp implementations. If it is a list, the first item is a string specifying the foreign function name and the second it is a symbol stating the Lisp name.</para>
26 </listitem>
27 </varlistentry>
28 <varlistentry>
29 <term><parameter>args</parameter></term>
30 <listitem>
31 <para>A list of argument declarations. If &nil;, indicates that the function does not take any arguments.</para>
32 </listitem>
33 </varlistentry>
34 <varlistentry>
35 <term><parameter>module</parameter></term>
36 <listitem>
37 <para>A string specifying which module (or library) that the foreign function resides. (Required by Lispworks)</para>
38 </listitem>
39 </varlistentry>
40 <varlistentry>
41 <term><returnvalue>returning</returnvalue></term>
42 <listitem>
43 <para>A declaration specifying the result type of the
44 foreign function. If <constant>:void</constant> indicates module does not return any value.</para>
45 </listitem>
46 </varlistentry>
47 </variablelist>
48 </refsynopsisdiv>
49
50 <refsect1>
51 <title>Description</title>
52 <para>Declares a foreign function.</para>
53 </refsect1>
54 <refsect1>
55 <title>Examples</title>
56 <programlisting>
57 (def-function "gethostname"
58 ((name (* :unsigned-char))
59 (len :int))
60 :returning :int)
61 </programlisting>
62 </refsect1>
63 <refsect1>
64 <title>Side Effects</title>
65 <para>None.</para>
66 </refsect1>
67 <refsect1>
68 <title>Affected by</title>
69 <para>None.</para>
70 </refsect1>
71 <refsect1>
72 <title>Exceptional Situations</title>
73 <para>None.</para>
74 </refsect1>
75 </refentry>
76
77 <refentry xml:id="uffi.load-foreign-library">
78 <refnamediv>
79 <refname><function>load-foreign-library</function></refname>
80 <refpurpose>Loads a foreign library.
81 </refpurpose>
82 </refnamediv>
83 <refsynopsisdiv>
84 <title>Function</title>
85 <synopsis>
86 <function>load-foreign-library</function> <replaceable>filename &amp;key module supporting-libraries force-load</replaceable> => <returnvalue>success</returnvalue>
87 </synopsis>
88 <variablelist>
89 <varlistentry>
90 <term><parameter>filename</parameter></term>
91 <listitem>
92 <para>A string or pathname specifying the library location
93 in the filesystem. At least one implementation (&LW;) can not
94 accept a logical pathname. If this parameter denotes a pathname without a
95 directory component then most of the supported Lisp implementations will be
96 able to find the library themselves if it is located in one of the standard
97 locations as defined by the underlying operating system.</para>
98 </listitem>
99 </varlistentry>
100 <varlistentry>
101 <term><parameter>module</parameter></term>
102 <listitem>
103 <para>A string designating the name of the module to apply
104 to functions in this library. (Required for Lispworks)</para>
105 </listitem>
106 </varlistentry>
107 <varlistentry>
108 <term><parameter>supporting-libraries</parameter></term>
109 <listitem>
110 <para>A list of strings naming the libraries required to
111 link the foreign library. (Required by CMUCL)</para>
112 </listitem>
113 </varlistentry>
114 <varlistentry>
115 <term><parameter>force-load</parameter></term>
116 <listitem>
117 <para>Forces the loading of the library if it has been previously loaded. </para>
118 </listitem>
119 </varlistentry>
120 <varlistentry>
121 <term><returnvalue>success</returnvalue></term>
122 <listitem>
123 <para>A boolean flag, &t; if the library was able to be
124 loaded successfully or if the library has been previously loaded,
125 otherwise &nil;.</para>
126 </listitem>
127 </varlistentry>
128 </variablelist>
129 </refsynopsisdiv>
130
131 <refsect1>
132 <title>Description</title>
133 <para>Loads a foreign library. Applies a module name to functions
134 within the library. Ensures that a library is only loaded once during
135 a session. A library can be reloaded by using the <symbol>:force-load</symbol> key.</para>
136 </refsect1>
137 <refsect1>
138 <title>Examples</title>
139 <screen>
140 (load-foreign-library #p"/usr/lib/libmysqlclient.so"
141 :module "mysql"
142 :supporting-libraries '("c"))
143 => T</screen>
144 </refsect1>
145 <refsect1>
146 <title>Side Effects</title>
147 <para>Loads the foreign code into the Lisp system.</para>
148 </refsect1>
149 <refsect1>
150 <title>Affected by</title>
151 <para>Ability to load the file.</para>
152 </refsect1>
153 <refsect1>
154 <title>Exceptional Situations</title>
155 <para>None.</para>
156 </refsect1>
157 </refentry>
158
159 <refentry xml:id="uffi.find-foreign-library">
160 <refnamediv>
161 <refname><function>find-foreign-library</function></refname>
162 <refpurpose>Finds a foreign library file.
163 </refpurpose>
164 </refnamediv>
165 <refsynopsisdiv>
166 <title>Function</title>
167 <synopsis>
168 <function>find-foreign-library</function> <replaceable>names directories &amp; drive-letters types</replaceable> => <returnvalue>path</returnvalue>
169 </synopsis>
170 <variablelist>
171 <varlistentry>
172 <term><parameter>names</parameter></term>
173 <listitem>
174 <para>A string or list of strings containing the base name of the
175 library file.</para>
176 </listitem>
177 </varlistentry>
178 <varlistentry>
179 <term><parameter>directories</parameter></term>
180 <listitem>
181 <para>A string or list of strings containing the directory the library file.</para>
182 </listitem>
183 </varlistentry>
184 <varlistentry>
185 <term><parameter>drive-letters</parameter></term>
186 <listitem>
187 <para>A string or list of strings containing the drive letters for the library file.</para>
188 </listitem>
189 </varlistentry>
190 <varlistentry>
191 <term><parameter>types</parameter></term>
192 <listitem>
193 <para>A string or list of strings containing the file type of the library file. Default
194 is &nil;. If &nil;, will use a default type based on the currently running implementation.</para>
195 </listitem>
196 </varlistentry>
197 <varlistentry>
198 <term><returnvalue>path</returnvalue></term>
199 <listitem>
200 <para>A path containing the path found, or &nil; if the library file was not found.</para>
201 </listitem>
202 </varlistentry>
203 </variablelist>
204 </refsynopsisdiv>
205
206 <refsect1>
207 <title>Description</title>
208 <para>Finds a foreign library by searching through a number of possible locations. Returns
209 the path of the first found file.</para>
210 </refsect1>
211 <refsect1>
212 <title>Examples</title>
213 <screen>
214 (find-foreign-library '("libmysqlclient" "libmysql")
215 '("/opt/mysql/lib/mysql/" "/usr/local/lib/" "/usr/lib/" "/mysql/lib/opt/")
216 :types '("so" "dll")
217 :drive-letters '("C" "D" "E"))
218 => #P"D:\\mysql\\lib\\opt\\libmysql.dll"
219 </screen>
220 </refsect1>
221 <refsect1>
222 <title>Side Effects</title>
223 <para>None.</para>
224 </refsect1>
225 <refsect1>
226 <title>Affected by</title>
227 <para>None.</para>
228 </refsect1>
229 <refsect1>
230 <title>Exceptional Situations</title>
231 <para>None.</para>
232 </refsect1>
233 </refentry>
234
235 </reference>
236 </book>
237 <!-- Keep this comment at the end of the file
238 Local variables:
239 mode: nxml
240 sgml-indent-step: 1
241 nxml-child-indent: 1
242 nxml-outline-child-indent: 0
243 fill-column: 79
244 End:
245 -->