I want to build a shared library from code in commonlisp. I have a file simple.lisp with following content:
(defun hello () (format t "Hello, world!~%")) Now I'm trying to start ecl and perform some commands. First of all I should compile program to object file: > (compile-file "simple.lisp" :system-p t) ;;; Loading #P"/usr/lib64/ecl-11.1.1/cmp.fas" ;;; ;;; Compiling simple.lisp. ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0 ;;; ;;; Compiling (DEFUN HELLO ...). ;;; End of Pass 1. ;;; Emitting code for HELLO. ;;; Note: ;;; Invoking external command: ;;; x86_64-pc-linux-gnu-gcc -I. -I/usr/include/ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=k8 -pipe -fPIC -D_THREAD_SAFE -Dlinux -O2 -w -c simple.c -o simple.o ;;; Finished compiling simple.lisp. ;;; #P"/home/nitnatsnok/lisp/simple.o" NIL NIL Well. Next I build a shared library as said in the official documentation: > (c:build-shared-library "simple" :lisp-files '("simple.o") :init-name "simple_init") ;;; Note: ;;; Invoking external command: ;;; x86_64-pc-linux-gnu-gcc -I. -I/usr/include/ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=k8 -pipe -fPIC -D_THREAD_SAFE -Dlinux -O2 -w -c /tmp/eclinit4NgxPc.c -o /tmp/eclinit4NgxPc.o ;;; Note: ;;; Invoking external command: ;;; x86_64-pc-linux-gnu-gcc -o libsimple.so -L/usr/lib64/ /tmp/eclinit4NgxPc.o (simple.o) -Wl,--rpath,/usr/lib64/ -shared -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -lecl -lgmp -lgc -lpthread -ldl -lm In function COPY-TO-SIMPLE-BASE-STRING, the value of the first argument is ("simple.o") which is not of the expected type STRING Available restarts: 1. (RESTART-TOPLEVEL) Go back to Top-Level REPL. Broken at SI:BYTECODES. [Evaluation of: (C:BUILD-SHARED-LIBRARY "simple" :LISP-FILES '("simple.o") :INIT-NAME "simple_init")] In: #<process TOP-LEVEL>. When I perform the same command with word "static" instead of "shared", everything is going fine: > (c:build-static-library "simple" :lisp-files '("simple.o") :init-name "simple_init") ;;; Note: ;;; Invoking external command: ;;; x86_64-pc-linux-gnu-gcc -I. -I/usr/include/ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=k8 -pipe -fPIC -D_THREAD_SAFE -Dlinux -O2 -w -c /tmp/eclinitM0T9S2.c -o /tmp/eclinitM0T9S2.o ;;; Note: ;;; Invoking external command: ;;; x86_64-pc-linux-gnu-ar cr libsimple.a /tmp/eclinitM0T9S2.o simple.o ;;; Note: ;;; Invoking external command: ;;; x86_64-pc-linux-gnu-ranlib libsimple.a #P"libsimple.a" What am I doing wrong? Thank you for help in advance. ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure _______________________________________________ Ecls-list mailing list Ecls-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ecls-list