## Make a little shared object files to test with.
build_so() {
- echo building $1.so
- cc -c $1.c -o $1.o
- ld -shared -o $1.so $1.o
+ echo building $1.so
+ if [ $(uname -p) = x86_64 ]; then
+ CFLAGS="$CFLAGS -fPIC"
+ fi
+ if [ $(uname) = Darwin ]; then
+ SO_FLAGS="-bundle"
+ else
+ SO_FLAGS="-shared"
+ fi
+ cc -c $1.c -o $1.o $CFLAGS
+ ld $SO_FLAGS -o $1.so $1.o
}
echo 'int summish(int x, int y) { return 1 + x + y; }' > $testfilestem.c
echo 'int numberish = 42;' >> $testfilestem.c
echo 'int nummish(int x) { return numberish + x; }' >> $testfilestem.c
+echo 'short negative_short() { return -1; }' >> $testfilestem.c
+echo 'int negative_int() { return -2; }' >> $testfilestem.c
+echo 'long negative_long() { return -3; }' >> $testfilestem.c
build_so $testfilestem
echo 'int foo = 13;' > $testfilestem-b.c
(define-alien-variable "foo" int)
(define-alien-routine "bar" int)
+ (define-alien-routine "negative_short" short)
+ (define-alien-routine "negative_int" int)
+ (define-alien-routine "negative_long" long)
+
;; Test that loading an object file didn't screw up our records
;; of variables visible in runtime. (This was a bug until
;; Nikodemus Siivola's patch in sbcl-0.8.5.50.)
(lambda (condition hook)
(print (list :debugger-hook condition))
(let ((cont (find-restart 'continue condition)))
- (when cont
+ (when cont
(invoke-restart cont)))
(print :fell-through)
(invoke-debugger condition)))
(assert (= 13 numberish))
(assert (= 14 (nummish 1)))
+ (assert (= -1 (negative-short)))
+ (assert (= -2 (negative-int)))
+ (assert (= -3 (negative-long)))
+
(print :stage-1)
;; test realoading object file with new definitions