ccl on 64 bit Windows: long should be 4 bytes
[cffi.git] / tests / defcfun.lisp
blobc1ceff302741e8b7e288bac765b0ace02e3751cc
1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; defcfun.lisp --- Tests function definition and calling.
4 ;;;
5 ;;; Copyright (C) 2005-2007, Luis Oliveira <loliveira@common-lisp.net>
6 ;;;
7 ;;; Permission is hereby granted, free of charge, to any person
8 ;;; obtaining a copy of this software and associated documentation
9 ;;; files (the "Software"), to deal in the Software without
10 ;;; restriction, including without limitation the rights to use, copy,
11 ;;; modify, merge, publish, distribute, sublicense, and/or sell copies
12 ;;; of the Software, and to permit persons to whom the Software is
13 ;;; furnished to do so, subject to the following conditions:
14 ;;;
15 ;;; The above copyright notice and this permission notice shall be
16 ;;; included in all copies or substantial portions of the Software.
17 ;;;
18 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 ;;; DEALINGS IN THE SOFTWARE.
26 ;;;
28 (in-package #:cffi-tests)
30 (deftest defcfun.parse-name-and-options.1
31 (multiple-value-bind (lisp-name foreign-name)
32 (let ((*package* (find-package '#:cffi-tests)))
33 (cffi::parse-name-and-options "foo_bar"))
34 (list lisp-name foreign-name))
35 (foo-bar "foo_bar"))
37 (deftest defcfun.parse-name-and-options.2
38 (multiple-value-bind (lisp-name foreign-name)
39 (let ((*package* (find-package '#:cffi-tests)))
40 (cffi::parse-name-and-options "foo_bar" t))
41 (list lisp-name foreign-name))
42 (*foo-bar* "foo_bar"))
44 (deftest defcfun.parse-name-and-options.3
45 (multiple-value-bind (lisp-name foreign-name)
46 (cffi::parse-name-and-options 'foo-bar)
47 (list lisp-name foreign-name))
48 (foo-bar "foo_bar"))
50 (deftest defcfun.parse-name-and-options.4
51 (multiple-value-bind (lisp-name foreign-name)
52 (cffi::parse-name-and-options '*foo-bar* t)
53 (list lisp-name foreign-name))
54 (*foo-bar* "foo_bar"))
56 (deftest defcfun.parse-name-and-options.5
57 (multiple-value-bind (lisp-name foreign-name)
58 (cffi::parse-name-and-options '("foo_bar" foo-baz))
59 (list lisp-name foreign-name))
60 (foo-baz "foo_bar"))
62 (deftest defcfun.parse-name-and-options.6
63 (multiple-value-bind (lisp-name foreign-name)
64 (cffi::parse-name-and-options '("foo_bar" *foo-baz*) t)
65 (list lisp-name foreign-name))
66 (*foo-baz* "foo_bar"))
68 (deftest defcfun.parse-name-and-options.7
69 (multiple-value-bind (lisp-name foreign-name)
70 (cffi::parse-name-and-options '(foo-baz "foo_bar"))
71 (list lisp-name foreign-name))
72 (foo-baz "foo_bar"))
74 (deftest defcfun.parse-name-and-options.8
75 (multiple-value-bind (lisp-name foreign-name)
76 (cffi::parse-name-and-options '(*foo-baz* "foo_bar") t)
77 (list lisp-name foreign-name))
78 (*foo-baz* "foo_bar"))
80 ;;;# Name translation
82 (deftest translate-underscore-separated-name.to-symbol
83 (let ((*package* (find-package '#:cffi-tests)))
84 (translate-underscore-separated-name "some_name_with_underscores"))
85 some-name-with-underscores)
87 (deftest translate-underscore-separated-name.to-string
88 (translate-underscore-separated-name 'some-name-with-underscores)
89 "some_name_with_underscores")
91 (deftest translate-camelcase-name.to-symbol
92 (let ((*package* (find-package '#:cffi-tests)))
93 (translate-camelcase-name "someXmlFunction"))
94 some-xml-function)
96 (deftest translate-camelcase-name.to-string
97 (translate-camelcase-name 'some-xml-function)
98 "someXmlFunction")
100 (deftest translate-camelcase-name.to-string-upper
101 (translate-camelcase-name 'some-xml-function :upper-initial-p t)
102 "SomeXmlFunction")
104 (deftest translate-camelcase-name.to-symbol-special
105 (let ((*package* (find-package '#:cffi-tests)))
106 (translate-camelcase-name "someXMLFunction" :special-words '("XML")))
107 some-xml-function)
109 (deftest translate-camelcase-name.to-string-special
110 (translate-camelcase-name 'some-xml-function :special-words '("XML"))
111 "someXMLFunction")
113 (deftest translate-name-from-foreign.function
114 (let ((*package* (find-package '#:cffi-tests)))
115 (translate-name-from-foreign "some_xml_name" *package*))
116 some-xml-name)
118 (deftest translate-name-from-foreign.var
119 (let ((*package* (find-package '#:cffi-tests)))
120 (translate-name-from-foreign "some_xml_name" *package* t))
121 *some-xml-name*)
123 (deftest translate-name-to-foreign.function
124 (translate-name-to-foreign 'some-xml-name *package*)
125 "some_xml_name")
127 (deftest translate-name-to-foreign.var
128 (translate-name-to-foreign '*some-xml-name* *package* t)
129 "some_xml_name")
131 ;;;# Calling with built-in c types
133 ;;; Tests calling standard C library functions both passing
134 ;;; and returning each built-in type. (adapted from funcall.lisp)
136 (defcfun "toupper" :char
137 "toupper docstring"
138 (char :char))
140 (deftest defcfun.char
141 (toupper (char-code #\a))
142 #.(char-code #\A))
144 (deftest defcfun.docstring
145 (documentation 'toupper 'function)
146 "toupper docstring")
149 (defcfun ("abs" c-abs) :int
150 (n :int))
152 (deftest defcfun.int
153 (c-abs -100)
154 100)
157 (defcfun "labs" :long
158 (n :long))
160 (deftest defcfun.long
161 (labs -131072)
162 131072)
165 #-cffi-features:no-long-long
166 (progn
167 (defcfun "my_llabs" :long-long
168 (n :long-long))
170 (deftest defcfun.long-long
171 (my-llabs -9223372036854775807)
172 9223372036854775807)
174 (defcfun "ullong" :unsigned-long-long
175 (n :unsigned-long-long))
177 #+allegro ; lp#914500
178 (pushnew 'defcfun.unsigned-long-long rt::*expected-failures*)
180 (deftest defcfun.unsigned-long-long
181 (let ((ullong-max (1- (expt 2 (* 8 (foreign-type-size :unsigned-long-long))))))
182 (eql ullong-max (ullong ullong-max)))
186 (defcfun "my_sqrtf" :float
187 (n :float))
189 (deftest defcfun.float
190 (my-sqrtf 16.0)
191 4.0)
194 (defcfun ("sqrt" c-sqrt) :double
195 (n :double))
197 (deftest defcfun.double
198 (c-sqrt 36.0d0)
199 6.0d0)
202 #+(and scl long-float)
203 (defcfun ("sqrtl" c-sqrtl) :long-double
204 (n :long-double))
206 #+(and scl long-float)
207 (deftest defcfun.long-double
208 (c-sqrtl 36.0l0)
209 6.0l0)
212 (defcfun "strlen" :int
213 (n :string))
215 (deftest defcfun.string.1
216 (strlen "Hello")
220 (defcfun "strcpy" (:pointer :char)
221 (dest (:pointer :char))
222 (src :string))
224 (defcfun "strcat" (:pointer :char)
225 (dest (:pointer :char))
226 (src :string))
228 (deftest defcfun.string.2
229 (with-foreign-pointer-as-string (s 100)
230 (setf (mem-ref s :char) 0)
231 (strcpy s "Hello")
232 (strcat s ", world!"))
233 "Hello, world!")
235 (defcfun "strerror" :string
236 (n :int))
238 (deftest defcfun.string.3
239 (typep (strerror 1) 'string)
243 ;;; Regression test. Allegro would warn on direct calls to
244 ;;; functions with no arguments.
246 ;;; Also, let's check if void functions will return NIL.
248 ;;; Check if a docstring without arguments doesn't cause problems.
250 (defcfun "noargs" :int
251 "docstring")
253 (deftest defcfun.noargs
254 (noargs)
257 (defcfun "noop" :void)
259 #+(or allegro openmcl ecl) (pushnew 'defcfun.noop rt::*expected-failures*)
261 (deftest defcfun.noop
262 (noop)
263 #|no values|#)
265 ;;;# Calling varargs functions
267 (defcfun "sprintf" :int
268 "sprintf docstring"
269 (str (:pointer :char))
270 (control :string)
271 &rest)
273 ;;; CLISP and ABCL discard macro docstrings.
274 #+(or clisp abcl)
275 (pushnew 'defcfun.varargs.docstrings rt::*expected-failures*)
277 (deftest defcfun.varargs.docstrings
278 (documentation 'sprintf 'function)
279 "sprintf docstring")
281 (deftest defcfun.varargs.char
282 (with-foreign-pointer-as-string (s 100)
283 (sprintf s "%c" :char 65))
284 "A")
286 (deftest defcfun.varargs.short
287 (with-foreign-pointer-as-string (s 100)
288 (sprintf s "%d" :short 42))
289 "42")
291 (deftest defcfun.varargs.int
292 (with-foreign-pointer-as-string (s 100)
293 (sprintf s "%d" :int 1000))
294 "1000")
296 (deftest defcfun.varargs.long
297 (with-foreign-pointer-as-string (s 100)
298 (sprintf s "%ld" :long 131072))
299 "131072")
301 (deftest defcfun.varargs.float
302 (with-foreign-pointer-as-string (s 100)
303 (sprintf s "%.2f" :float (float pi)))
304 "3.14")
306 (deftest defcfun.varargs.double
307 (with-foreign-pointer-as-string (s 100)
308 (sprintf s "%.2f" :double (float pi 1.0d0)))
309 "3.14")
311 #+(and scl long-float)
312 (deftest defcfun.varargs.long-double
313 (with-foreign-pointer-as-string (s 100)
314 (setf (mem-ref s :char) 0)
315 (sprintf s "%.2Lf" :long-double pi))
316 "3.14")
318 (deftest defcfun.varargs.string
319 (with-foreign-pointer-as-string (s 100)
320 (sprintf s "%s, %s!" :string "Hello" :string "world"))
321 "Hello, world!")
323 ;;; (let ((rettype (find-type :long))
324 ;;; (arg-types (n-random-types-no-ll 127)))
325 ;;; (c-function rettype arg-types)
326 ;;; (gen-function-test rettype arg-types))
328 #+(and (not ecl)
329 #.(cl:if (cl:>= cl:lambda-parameters-limit 127) '(:and) '(:or)))
330 (progn
331 (defcfun "sum_127_no_ll" :long
332 (a1 :long) (a2 :unsigned-long) (a3 :short) (a4 :unsigned-short) (a5 :float)
333 (a6 :double) (a7 :unsigned-long) (a8 :float) (a9 :unsigned-char)
334 (a10 :unsigned-short) (a11 :short) (a12 :unsigned-long) (a13 :double)
335 (a14 :long) (a15 :unsigned-int) (a16 :pointer) (a17 :unsigned-int)
336 (a18 :unsigned-short) (a19 :long) (a20 :float) (a21 :pointer) (a22 :float)
337 (a23 :int) (a24 :int) (a25 :unsigned-short) (a26 :long) (a27 :long)
338 (a28 :double) (a29 :unsigned-char) (a30 :unsigned-int) (a31 :unsigned-int)
339 (a32 :int) (a33 :unsigned-short) (a34 :unsigned-int) (a35 :pointer)
340 (a36 :double) (a37 :double) (a38 :long) (a39 :short) (a40 :unsigned-short)
341 (a41 :long) (a42 :char) (a43 :long) (a44 :unsigned-short) (a45 :pointer)
342 (a46 :int) (a47 :unsigned-int) (a48 :double) (a49 :unsigned-char)
343 (a50 :unsigned-char) (a51 :float) (a52 :int) (a53 :unsigned-short)
344 (a54 :double) (a55 :short) (a56 :unsigned-char) (a57 :unsigned-long)
345 (a58 :float) (a59 :float) (a60 :float) (a61 :pointer) (a62 :pointer)
346 (a63 :unsigned-int) (a64 :unsigned-long) (a65 :char) (a66 :short)
347 (a67 :unsigned-short) (a68 :unsigned-long) (a69 :pointer) (a70 :float)
348 (a71 :double) (a72 :long) (a73 :unsigned-long) (a74 :short)
349 (a75 :unsigned-int) (a76 :unsigned-short) (a77 :int) (a78 :unsigned-short)
350 (a79 :char) (a80 :double) (a81 :short) (a82 :unsigned-char) (a83 :float)
351 (a84 :char) (a85 :int) (a86 :double) (a87 :unsigned-char) (a88 :int)
352 (a89 :unsigned-long) (a90 :double) (a91 :short) (a92 :short)
353 (a93 :unsigned-int) (a94 :unsigned-char) (a95 :float) (a96 :long)
354 (a97 :float) (a98 :long) (a99 :long) (a100 :int) (a101 :int)
355 (a102 :unsigned-int) (a103 :char) (a104 :char) (a105 :unsigned-short)
356 (a106 :unsigned-int) (a107 :unsigned-short) (a108 :unsigned-short)
357 (a109 :int) (a110 :long) (a111 :char) (a112 :double) (a113 :unsigned-int)
358 (a114 :char) (a115 :short) (a116 :unsigned-long) (a117 :unsigned-int)
359 (a118 :short) (a119 :unsigned-char) (a120 :float) (a121 :pointer)
360 (a122 :double) (a123 :int) (a124 :long) (a125 :char) (a126 :unsigned-short)
361 (a127 :float))
363 (deftest defcfun.bff.1
364 (sum-127-no-ll
365 1442906394 520035521 -4715 50335 -13557.0 -30892.0d0 24061483 -23737.0
366 22 2348 4986 104895680 8073.0d0 -571698147 102484400
367 (make-pointer 507907275) 12733353 7824 -1275845284 13602.0
368 (make-pointer 286958390) -8042.0 -773681663 -1289932452 31199 -154985357
369 -170994216 16845.0d0 177 218969221 2794350893 6068863 26327 127699339
370 (make-pointer 184352771) 18512.0d0 -12345.0d0 -179853040 -19981 37268
371 -792845398 116 -1084653028 50494 (make-pointer 2105239646) -1710519651
372 1557813312 2839.0d0 90 180 30580.0 -532698978 8623 9537.0d0 -10882 54
373 184357206 14929.0 -8190.0 -25615.0 (make-pointer 235310526)
374 (make-pointer 220476977) 7476055 1576685 -117 -11781 31479 23282640
375 (make-pointer 8627281) -17834.0 10391.0d0 -1904504370 114393659 -17062
376 637873619 16078 -891210259 8107 0 760.0d0 -21268 104 14133.0 10
377 588598141 310.0d0 20 1351785456 16159552 -10121.0d0 -25866 24821
378 68232851 60 -24132.0 -1660411658 13387.0 -786516668 -499825680
379 -1128144619 111849719 2746091587 -2 95 14488 326328135 64781 18204
380 150716680 -703859275 103 16809.0d0 852235610 -43 21088 242356110
381 324325428 -22380 23 24814.0 (make-pointer 40362014) -14322.0d0
382 -1864262539 523684371 -21 49995 -29175.0)
383 796447501))
385 ;;; (let ((rettype (find-type :long-long))
386 ;;; (arg-types (n-random-types 127)))
387 ;;; (c-function rettype arg-types)
388 ;;; (gen-function-test rettype arg-types))
390 #-(or ecl cffi-sys::no-long-long
391 #.(cl:if (cl:>= cl:lambda-parameters-limit 127) '(:or) '(:and)))
392 (progn
393 (defcfun "sum_127" :long-long
394 (a1 :pointer) (a2 :pointer) (a3 :float) (a4 :unsigned-long) (a5 :pointer)
395 (a6 :long-long) (a7 :double) (a8 :double) (a9 :unsigned-short) (a10 :int)
396 (a11 :long-long) (a12 :long) (a13 :short) (a14 :unsigned-int) (a15 :long)
397 (a16 :unsigned-char) (a17 :int) (a18 :double) (a19 :short) (a20 :short)
398 (a21 :long-long) (a22 :unsigned-int) (a23 :unsigned-short) (a24 :short)
399 (a25 :pointer) (a26 :short) (a27 :unsigned-short) (a28 :unsigned-short)
400 (a29 :int) (a30 :long-long) (a31 :pointer) (a32 :int) (a33 :unsigned-long)
401 (a34 :unsigned-long) (a35 :pointer) (a36 :unsigned-long-long) (a37 :float)
402 (a38 :int) (a39 :short) (a40 :pointer) (a41 :unsigned-long-long)
403 (a42 :long-long) (a43 :unsigned-long) (a44 :unsigned-long)
404 (a45 :unsigned-long-long) (a46 :unsigned-long) (a47 :char) (a48 :double)
405 (a49 :long) (a50 :unsigned-int) (a51 :int) (a52 :short) (a53 :pointer)
406 (a54 :long) (a55 :unsigned-long-long) (a56 :int) (a57 :unsigned-short)
407 (a58 :unsigned-long-long) (a59 :float) (a60 :pointer) (a61 :float)
408 (a62 :unsigned-short) (a63 :unsigned-long) (a64 :float) (a65 :unsigned-int)
409 (a66 :unsigned-long-long) (a67 :pointer) (a68 :double)
410 (a69 :unsigned-long-long) (a70 :double) (a71 :double) (a72 :long-long)
411 (a73 :pointer) (a74 :unsigned-short) (a75 :long) (a76 :pointer) (a77 :short)
412 (a78 :double) (a79 :long) (a80 :unsigned-char) (a81 :pointer)
413 (a82 :unsigned-char) (a83 :long) (a84 :double) (a85 :pointer) (a86 :int)
414 (a87 :double) (a88 :unsigned-char) (a89 :double) (a90 :short) (a91 :long)
415 (a92 :int) (a93 :long) (a94 :double) (a95 :unsigned-short)
416 (a96 :unsigned-int) (a97 :int) (a98 :char) (a99 :long-long) (a100 :double)
417 (a101 :float) (a102 :unsigned-long) (a103 :short) (a104 :pointer)
418 (a105 :float) (a106 :long-long) (a107 :int) (a108 :long-long)
419 (a109 :long-long) (a110 :double) (a111 :unsigned-long-long) (a112 :double)
420 (a113 :unsigned-long) (a114 :char) (a115 :char) (a116 :unsigned-long)
421 (a117 :short) (a118 :unsigned-char) (a119 :unsigned-char) (a120 :int)
422 (a121 :int) (a122 :float) (a123 :unsigned-char) (a124 :unsigned-char)
423 (a125 :double) (a126 :unsigned-long-long) (a127 :char))
425 (deftest defcfun.bff.2
426 (sum-127
427 (make-pointer 2746181372) (make-pointer 177623060) -32334.0 3158055028
428 (make-pointer 242315091) 4288001754991016425 -21047.0d0 287.0d0 18722
429 243379286 -8677366518541007140 581399424 -13872 4240394881 1353358999
430 226 969197676 -26207.0d0 6484 11150 1241680089902988480 106068320 61865
431 2253 (make-pointer 866809333) -31613 35616 11715 1393601698
432 8940888681199591845 (make-pointer 1524606024) 805638893 3315410736
433 3432596795 (make-pointer 1490355706) 696175657106383698 -25438.0
434 1294381547 26724 (make-pointer 3196569545) 2506913373410783697
435 -4405955718732597856 4075932032 3224670123 2183829215657835866
436 1318320964 -22 -3786.0d0 -2017024146 1579225515 -626617701 -1456
437 (make-pointer 3561444187) 395687791 1968033632506257320 -1847773261
438 48853 142937735275669133 -17974.0 (make-pointer 2791749948) -14140.0
439 2707 3691328585 3306.0 1132012981 303633191773289330
440 (make-pointer 981183954) 9114.0d0 8664374572369470 -19013.0d0
441 -10288.0d0 -3679345119891954339 (make-pointer 3538786709) 23761
442 -154264605 (make-pointer 2694396308) 7023 997.0d0 1009561368 241
443 (make-pointer 2612292671) 48 1431872408 -32675.0d0
444 (make-pointer 1587599336) 958916472 -9857.0d0 111 -14370.0d0 -7308
445 -967514912 488790941 2146978095 -24111.0d0 13711 86681861 717987770
446 111 1013402998690933877 17234.0d0 -8772.0 3959216275 -8711
447 (make-pointer 3142780851) 9480.0 -3820453146461186120 1616574376
448 -3336232268263990050 -1906114671562979758 -27925.0d0 9695970875869913114
449 27033.0d0 1096518219 -12 104 3392025403 -27911 60 89 509297051
450 -533066551 29158.0 110 54 -9802.0d0 593950442165910888 -79)
451 7758614658402721936))
453 ;;; regression test: defining an undefined foreign function should only
454 ;;; throw some sort of warning, not signal an error.
456 #+(or cmu (and sbcl (or (not linkage-table) win32)))
457 (pushnew 'defcfun.undefined rt::*expected-failures*)
459 (deftest defcfun.undefined
460 (progn
461 (eval '(defcfun ("undefined_foreign_function" undefined-foreign-function) :void))
462 (compile 'undefined-foreign-function)
466 ;;; Test whether all doubles are passed correctly. On some platforms, eg.
467 ;;; darwin/ppc, some are passed on registers others on the stack.
468 (defcfun "sum_double26" :double
469 (a1 :double) (a2 :double) (a3 :double) (a4 :double) (a5 :double)
470 (a6 :double) (a7 :double) (a8 :double) (a9 :double) (a10 :double)
471 (a11 :double) (a12 :double) (a13 :double) (a14 :double) (a15 :double)
472 (a16 :double) (a17 :double) (a18 :double) (a19 :double) (a20 :double)
473 (a21 :double) (a22 :double) (a23 :double) (a24 :double) (a25 :double)
474 (a26 :double))
476 (deftest defcfun.double26
477 (sum-double26 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0
478 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0
479 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0
480 3.14d0 3.14d0 3.14d0 3.14d0 3.14d0)
481 81.64d0)
483 ;;; Same as above for floats.
484 (defcfun "sum_float26" :float
485 (a1 :float) (a2 :float) (a3 :float) (a4 :float) (a5 :float)
486 (a6 :float) (a7 :float) (a8 :float) (a9 :float) (a10 :float)
487 (a11 :float) (a12 :float) (a13 :float) (a14 :float) (a15 :float)
488 (a16 :float) (a17 :float) (a18 :float) (a19 :float) (a20 :float)
489 (a21 :float) (a22 :float) (a23 :float) (a24 :float) (a25 :float)
490 (a26 :float))
492 (deftest defcfun.float26
493 (sum-float26 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0
494 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0)
495 130.0)
497 ;;;# Namespaces
499 #-cffi-sys::flat-namespace
500 (progn
501 (defcfun ("ns_function" ns-fun1 :library libtest) :boolean)
502 (defcfun ("ns_function" ns-fun2 :library libtest2) :boolean)
504 (deftest defcfun.namespace.1
505 (values (ns-fun1) (ns-fun2))
506 t nil))
508 ;;;# stdcall
510 #+(and x86 windows (not cffi-sys::no-stdcall))
511 (progn
512 (defcfun ("stdcall_fun@12" stdcall-fun :convention :stdcall) :int
513 (a :int)
514 (b :int)
515 (c :int))
517 (deftest defcfun.stdcall.1
518 (loop repeat 100 do (stdcall-fun 1 2 3)
519 finally (return (stdcall-fun 1 2 3)))