[d0e0b7]: uffi / ref_object.xml Maximize Restore History

Download this file

ref_object.xml    832 lines (779 with data), 22.6 kB

  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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book [
<!ENTITY % eclent SYSTEM "../ecl.ent">
%eclent;
]>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
<reference xml:id="uffi.objects">
<title>Objects</title>
<partintro>
<title>Overview</title>
<para>
Objects are entities that can allocated, referred to by pointers, and
can be freed.</para>
</partintro>
<refentry xml:id="uffi.allocate-foreign-object">
<refnamediv>
<refname><function>allocate-foreign-object</function></refname>
<refpurpose>Allocates an instance of a foreign object.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>allocate-foreign-object</funcdef>
<paramdef><parameter>type</parameter></paramdef>
<paramdef>&optional;</paramdef>
<paramdef><parameter>size</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>The type of foreign object to allocate. This parameter is evaluated.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>size</parameter></term>
<listitem>
<para>An optional size parameter that is evaluated. If specified, allocates and returns an
array of <parameter>type</parameter> that is <parameter>size</parameter> members long. This parameter is evaluated.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>A pointer to the foreign object.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>Allocates an instance of a foreign object. It returns a pointer to
the object.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(def-struct ab (a :int) (b :double))
(allocate-foreign-object 'ab)
=> #&lt;ptr&gt;</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 xml:id="uffi.free-foreign-object">
<refnamediv>
<refname><function>free-foreign-object</function></refname>
<refpurpose>Frees memory that was allocated for a foreign boject.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>free-foreign-object</funcdef>
<paramdef><parameter>ptr</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>ptr</parameter></term>
<listitem>
<para>A pointer to the allocated foreign object to free.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Frees the memory used by the allocation of a foreign object.</para>
</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 xml:id="uffi.with-foreign-object">
<refnamediv>
<refname><function>with-foreign-object</function></refname>
<refpurpose>Wraps the allocation of a foreign object around a body of code.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>with-foreign-object</funcdef>
<paramdef><parameter>(var type)</parameter></paramdef>
<paramdef><parameter>&body;</parameter></paramdef>
<paramdef><parameter>body</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>var</parameter></term>
<listitem>
<para>The variable name to bind.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>The type of foreign object to allocate. This parameter is evaluated.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>The result of evaluating the <parameter>body</parameter>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title> <para> This function wraps the allocation,
binding, and destruction of a foreign object. On &CMUCL; and &LW;
platforms the object is stack allocated for efficiency. Benchmarks show
that &ACL; performs much better with static allocation.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(defun gethostname2 ()
"Returns the hostname"
(uffi:with-foreign-object (name '(:array :unsigned-char 256))
(if (zerop (c-gethostname (uffi:char-array-to-pointer name) 256))
(uffi:convert-from-foreign-string name)
(error "gethostname() failed."))))</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 xml:id="uffi.size-of-foreign-type">
<refnamediv>
<refname><function>size-of-foreign-type</function></refname>
<refpurpose>Returns the number of data bytes used by a foreign object type.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>size-of-foreign-type</funcdef>
<paramdef><parameter>ftype</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>ftype</parameter></term>
<listitem>
<para>A foreign type specifier. This parameter is evaluated.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Returns the number of data bytes used by a foreign object type. This does not include any Lisp storage overhead.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
<screen>
(size-of-foreign-object :unsigned-byte)
=> 1
(size-of-foreign-object 'my-100-byte-vector-type)
=> 100</screen></para>
</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 xml:id="uffi.pointer-address">
<refnamediv>
<refname><function>pointer-address</function></refname>
<refpurpose>Returns the address of a pointer.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>pointer-address</funcdef>
<paramdef><parameter>ptr</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>ptr</parameter></term>
<listitem>
<para>A pointer to a foreign object.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>An integer representing the pointer's address.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Returns the address as an integer of a pointer.</para>
</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 xml:id="uffi.deref-pointer">
<refnamediv>
<refname><function>deref-pointer</function></refname>
<refpurpose>Deferences a pointer.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>deref-pointer</funcdef>
<paramdef><parameter>ptr</parameter></paramdef>
<paramdef><parameter>type</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>ptr</parameter></term>
<listitem>
<para>A pointer to a foreign object.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>A foreign type of the object being pointed to.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>The value of the object where the pointer points.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Returns the object to which a pointer points.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
<screen>
(let ((intp (allocate-foreign-object :int)))
(setf (deref-pointer intp :int) 10)
(prog1
(deref-pointer intp :int)
(free-foreign-object intp)))
=> 10</screen></para>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
The TYPE argument is ignored for CL implementations other than
AllegroCL. If you want to cast a pointer to another type use
WITH-CAST-POINTER together with DEREF-POINTER/DEREF-ARRAY.</para>
</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 xml:id="uffi.ensure-char-character">
<refnamediv>
<refname><function>ensure-char-character</function></refname>
<refpurpose>Ensures that a dereferenced <constant>:char</constant> pointer is
a character.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>ensure-char-character</funcdef>
<paramdef><parameter>object</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>Either a character or a integer specifying a character code.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>A character.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Ensures that an objects obtained by dereferencing
<constant>:char</constant> and <constant>:unsigned-char</constant>
pointers are a lisp character.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
<screen>
(let ((fs (convert-to-foreign-string "a")))
(prog1
(ensure-char-character (deref-pointer fs :char))
(free-foreign-object fs)))
=> #\a</screen></para>
</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>Depending upon the implementation and what &UFFI; expects, this
macro may signal an error if the object is not a character or
integer.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.ensure-char-integer">
<refnamediv>
<refname><function>ensure-char-integer</function></refname>
<refpurpose>Ensures that a dereferenced <constant>:char</constant> pointer is
an integer.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>ensure-char-integer</funcdef>
<paramdef><parameter>object</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>Either a character or a integer specifying a character code.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>An integer.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Ensures that an object obtained by dereferencing a
<constant>:char</constant> pointer is an integer.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
<screen>
(let ((fs (convert-to-foreign-string "a")))
(prog1
(ensure-char-integer (deref-pointer fs :char))
(free-foreign-object fs)))
=> 96</screen></para>
</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>Depending upon the implementation and what &UFFI; expects, this
macro may signal an error if the object is not a character or
integer.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.make-null-pointer">
<refnamediv>
<refname><function>make-null-pointer</function></refname>
<refpurpose>Create a &NULL; pointer.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>make-null-pointer</funcdef>
<paramdef><parameter>type</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>A type of object to which the pointer refers.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>The &NULL; pointer of type <parameter>type</parameter>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Creates a &NULL; pointer of a specified type.</para>
</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 xml:id="uffi.null-pointer-p">
<refnamediv>
<refname><function>null-pointer-p</function></refname>
<refpurpose>Tests a pointer for &NULL; value.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>null-pointer-p</funcdef>
<paramdef><parameter>ptr</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>ptr</parameter></term>
<listitem>
<para>A foreign object pointer.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>The boolean flag.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
A predicate testing if a pointer is has a &NULL; value.</para>
</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 xml:id="uffi.null-cstring-pointer">
<refnamediv>
<refname><varname>+null-cstring-pointer+</varname></refname>
<refpurpose>A constant &NULL; cstring pointer.
</refpurpose>
<refclass>Constant</refclass>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
A &NULL; cstring pointer. This can be used for testing
if a cstring returned by a function is &NULL;.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.with-cast-pointer">
<refnamediv>
<refname><function>with-cast-pointer</function></refname>
<refpurpose>Wraps a body of code with a pointer cast to a new type.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>with-cast-pointer</funcdef>
<paramdef>(<parameter>binding-name ptr type</parameter>)</paramdef>
<paramdef>&body;</paramdef>
<paramdef><parameter>body</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>binding-name</parameter></term>
<listitem>
<para>A symbol which will be bound to the casted object.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ptr</parameter></term>
<listitem>
<para>A pointer to a foreign object.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>A foreign type of the object being pointed to.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>returns</term>
<listitem>
<para>The value of the object where the pointer points.</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Executes BODY with POINTER cast to be a pointer to type TYPE.
BINDING-NAME is will be bound to this value during the execution of
BODY.
This is a no-op in AllegroCL but will wrap BODY in a LET form if
BINDING-NAME is provided.
This macro is meant to be used in conjunction with DEREF-POINTER or
DEREF-ARRAY. In Allegro CL the "cast" will actually take place in
DEREF-POINTER or DEREF-ARRAY.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(with-foreign-object (size :int)
;; FOO is a foreign function returning a :POINTER-VOID
(let ((memory (foo size)))
(when (mumble)
;; at this point we know for some reason that MEMORY points
;; to an array of unsigned bytes
(with-cast-pointer (memory :unsigned-byte)
(dotimes (i (deref-pointer size :int))
(do-something-with
(deref-array memory '(:array :unsigned-byte) i)))))))</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 xml:id="uffi.def-foreign-var">
<refnamediv>
<refname><function>def-foreign-var</function></refname>
<refpurpose>
Defines a symbol macro to access a variable in foreign code
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Macro</title>
<funcsynopsis>
<funcprototype>
<funcdef>def-foreign-var</funcdef>
<paramdef><parameter>name</parameter></paramdef>
<paramdef><parameter>type</parameter></paramdef>
<paramdef><parameter>module</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
A string or list specificying the symbol macro's name. If it is a
string, that names the foreign variable. 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 variable name and the
second it is a symbol stating the Lisp name.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>A foreign type of the foreign variable.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><returnvalue>module</returnvalue></term>
<listitem>
<para>
A string specifying the module (or library) the foreign variable
resides in. (Required by Lispworks)</para>
</listitem>
</varlistentry>
</variablelist>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Defines a symbol macro which can be used to access (get and set) the
value of a variable in foreign code.</para>
</refsect1>
<refsect1>
<title>Examples</title>
<refsect2>
<title>C code</title>
<screen>
int baz = 3;
typedef struct {
int x;
double y;
} foo_struct;
foo_struct the_struct = { 42, 3.2 };
int foo () {
return baz;
}</screen>
</refsect2>
<refsect2>
<title>Lisp code</title>
<screen>
(uffi:def-struct foo-struct
(x :int)
(y :double))
(uffi:def-function ("foo" foo)
()
:returning :int
:module "foo")
(uffi:def-foreign-var ("baz" *baz*) :int "foo")
(uffi:def-foreign-var ("the_struct" *the-struct*) foo-struct "foo")
*baz*
=> 3
(incf *baz*)
=> 4
(foo)
=> 4</screen>
</refsect2>
</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>
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: nxml
sgml-indent-step: 1
nxml-child-indent: 1
nxml-outline-child-indent: 0
fill-column: 79
End:
-->