CFFI problem with LispWorks
Hello,for now, I am trying to use CFFI to interface C++ code towards LispWorks. I tested on a simple example and it works on the SBCL implementation of Common Lisp but not on LispWorks. The thing is I have to use LispWorks so I am stuck. I also have to be able to put code in different files. I am working on MacOS X and have to do. All the code used is showed below, with the error at the end. I tried to load the library libA.so only and it works but I need to load the library libB which doesn't.
Thank you for your help.
Sascha Van Cauwelaert.
Here are the different codes (files name are commented just above the code):
//a.hh
class A { public: void func(); };
//a.cc
#include <iostream>
#include "a.hh"
void A::func() { std::cout << "Hello World!" << std::endl; }
//b.cc
#include "a.hh"
extern "C" {
void a_func() { A *a = new A(); a->func(); delete a; }
}
//Makefile
all: libA.so libB.so
libA.so: a.cc
g++ -arch i386 -fPIC -o $@ -shared $<
libB.so: b.cc
g++ -arch i386 -fPIC -o $@ -shared -L. -lA $<
//load.lisp
;;before this, cffi loading is done
(cffi:load-foreign-library "/FullPathTowardsLibraryFile/libB..so")
Here is the error I got :
CL-USER 16 > (cffi:load-foreign-library "/FullPathTowardsLibraryFile/libB.so")
Error: Unable to load foreign library (LIBRARY-54605).
Could not register handle for external module #:LIBRARY-54605:
Library not loaded: libA.so
Referenced from: /FullPathTowardsLibraryFile/libB.so
Reason: image not found.
1 (continue) Try loading the foreign library again.
2 Use another library instead.
3 (abort) Return to level 0.
4 Return to top loop level 0.