File: ref_func_libr.xml

package info (click to toggle)
cl-uffi 2.1.2-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,028 kB
  • sloc: lisp: 3,854; xml: 2,990; makefile: 238; ansic: 169; sh: 35
file content (264 lines) | stat: -rw-r--r-- 8,228 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
               "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % myents SYSTEM "entities.inc">
%myents;
]>

<reference id="func_libr">
      <title>Functions &amp; Libraries</title>

      <refentry id="def-function">
	<refnamediv>
	  <refname>def-function</refname>
	<refpurpose>Declares a function. 
	</refpurpose>
	<refclass>Macro</refclass>
      </refnamediv>
      <refsynopsisdiv>
	<title>Syntax</title>
	<synopsis>
	  <function>def-function</function> <replaceable>name args &amp;key module returning</replaceable>
	</synopsis>
      </refsynopsisdiv>
      <refsect1>
	<title>Arguments and Values</title>
	<variablelist>
	  <varlistentry>
	    <term><parameter>name</parameter></term>
	    <listitem>
	      <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>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>args</parameter></term>
	    <listitem>
	      <para>A list of argument declarations. If &nil;, indicates that the function does not take any arguments.
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>module</parameter></term>
	    <listitem>
	      <para>A string specifying which module (or library) that the foreign function resides. (Required by Lispworks)</para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><returnvalue>returning</returnvalue></term>
	    <listitem>
	      <para>A declaration specifying the result type of the
foreign function. If <constant>:void</constant> indicates module does not return any value.
	      </para>
	    </listitem>
	  </varlistentry>
	</variablelist>
      </refsect1>
      <refsect1>
	<title>Description</title>
	<para>Declares a foreign function.
	</para>
      </refsect1>
      <refsect1>
	<title>Examples</title>
	<screen>
(def-function "gethostname" 
  ((name (* :unsigned-char))
   (len :int))
  :returning :int)
	</screen>
      </refsect1>
      <refsect1>
	<title>Side Effects</title>
	<para>None.</para>
      </refsect1>
      <refsect1>
	<title>Affected by</title>
	<para>None.</para>
      </refsect1>
      <refsect1>
	<title>Exceptional Situations</title>
	<para>None.</para>
      </refsect1>
    </refentry>

      <refentry id="load-foreign-library">
	<refnamediv>
	  <refname>load-foreign-library</refname>
	<refpurpose>Loads a foreign library. 
	</refpurpose>
	<refclass>Function</refclass>
      </refnamediv>
      <refsect1>
	<title>Syntax</title>
<synopsis>
	  <function>load-foreign-library</function> <replaceable>filename &amp;key module supporting-libraries force-load</replaceable> => <returnvalue>success</returnvalue>
</synopsis>
      </refsect1>
      <refsect1>
	<title>Arguments and Values</title>
	<variablelist>
	  <varlistentry>
	    <term><parameter>filename</parameter></term>
	    <listitem>
	      <para>A string or pathname specifying the library location
in the filesystem. At least one implementation (&lw;) can not
accept a logical pathname.  If this parameter denotes a pathname without a
directory component then most of the supported Lisp implementations will be
able to find the library themselves if it is located in one of the standard
locations as defined by the underlying operating system.
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>module</parameter></term>
	    <listitem>
	      <para>A string designating the name of the module to apply
to functions in this library. (Required for Lispworks)
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>supporting-libraries</parameter></term>
	    <listitem>
	      <para>A list of strings naming the libraries required to
link the foreign library. (Required by CMUCL)
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>force-load</parameter></term>
	    <listitem>
	      <para>Forces the loading of the library if it has been previously loaded. 
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><returnvalue>success</returnvalue></term>
	    <listitem>
	      <para>A boolean flag, &t; if the library was able to be
loaded successfully or if the library has been previously loaded,
	      </para>
	    </listitem>
	  </varlistentry>
	</variablelist>
      </refsect1>
      <refsect1>
	<title>Description</title>
	<para>Loads a foreign library. Applies a module name to functions
within the library. Ensures that a library is only loaded once during
a session. A library can be reloaded by using the <symbol>:force-load</symbol> key.
	</para>
      </refsect1>
      <refsect1>
	<title>Examples</title>
	<screen>
  (load-foreign-library #p"/usr/lib/libmysqlclient.so" 
                        :module "mysql" 
                        :supporting-libraries '("c"))
    => T
	</screen>
      </refsect1>
      <refsect1>
	<title>Side Effects</title>
	<para>Loads the foreign code into the Lisp system.
	</para>
      </refsect1>
      <refsect1>
	<title>Affected by</title>
	<para>Ability to load the file.</para>
      </refsect1>
      <refsect1>
	<title>Exceptional Situations</title>
	<para>An error will be signaled if the library is unable to be loaded.</para>
      </refsect1>
    </refentry>

      <refentry id="find-foreign-library">
	<refnamediv>
	  <refname>find-foreign-library</refname>
	<refpurpose>Finds a foreign library file.
	</refpurpose>
	<refclass>Function</refclass>
      </refnamediv>
      <refsect1>
	<title>Syntax</title>
<synopsis>
	  <function>find-foreign-library</function> <replaceable>names directories &amp; drive-letters types</replaceable> => <returnvalue>path</returnvalue>
</synopsis>
      </refsect1>
      <refsect1>
	<title>Arguments and Values</title>
	<variablelist>
	  <varlistentry>
	    <term><parameter>names</parameter></term>
	    <listitem>
	      <para>A string or list of strings containing the base name of the library file.
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>directories</parameter></term>
	    <listitem>
	      <para>A string or list of strings containing the directory the library file.
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>drive-letters</parameter></term>
	    <listitem>
	      <para>A string or list of strings containing the drive letters for the library file.
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><parameter>types</parameter></term>
	    <listitem>
	      <para>A string or list of strings containing the file type of the library file. Default
is &nil;. If &nil;, will use a default type based on the currently running implementation.
	      </para>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term><returnvalue>path</returnvalue></term>
	    <listitem>
	      <para>A path containing the path found, or &nil; if the library file was not found.
	      </para>
	    </listitem>
	  </varlistentry>
	</variablelist>
      </refsect1>
      <refsect1>
	<title>Description</title>
	<para>Finds a foreign library by searching through a number of possible locations. Returns
the path of the first found file.
	</para>
      </refsect1>
      <refsect1>
	<title>Examples</title>
	<screen>
(find-foreign-library '("libmysqlclient" "libmysql")
    '("/opt/mysql/lib/mysql/" "/usr/local/lib/" "/usr/lib/" "/mysql/lib/opt/")
    :types '("so" "dll")
    :drive-letters '("C" "D" "E"))
=> #P"D:\\mysql\\lib\\opt\\libmysql.dll"
	</screen>
      </refsect1>
      <refsect1>
	<title>Side Effects</title>
	<para>None.
	</para>
      </refsect1>
      <refsect1>
	<title>Affected by</title>
	<para>None.</para>
      </refsect1>
      <refsect1>
	<title>Exceptional Situations</title>
	<para>None.</para>
      </refsect1>
    </refentry>

</reference>