3 # tests related to foreign function interface and LOAD-FOREIGN
5 # This software is part of the SBCL system. See the README file for
8 # While most of SBCL is derived from the CMU CL system, the test
9 # files (like this one) were written from scratch after the fork
12 # This software is in the public domain and is provided with
13 # absolutely no warranty. See the COPYING and CREDITS files for
16 testfilestem=$TMPDIR/sbcl-foreign-test-$$
18 echo 'int summish(int x, int y) { return 1 + x + y; }' > $testfilestem.c
20 ld -shared -o $testfilestem.so $testfilestem.o
23 (when (fboundp 'load-foreign) ; not necessarily supported on all OSes..
24 (load-foreign '("$testfilestem.so"))
25 (def-alien-routine summish int (x int) (y int))
26 (assert (= (summish 10 20) 31)))
27 (sb-ext:quit :unix-status 52) ; success convention for Lisp program
34 # FIXME: I rewrote the handling of ENV/ENVIRONMENT arguments for
35 # LOAD-FOREIGN, but I can't think of a nice way to test it. (Kent Beck
36 # would cry. If he didn't keel over on the spot and then commence
37 # rolling over in his grave.:-) It would be good to make a test case
40 # success convention for script