Re: [Chicken-users] Compiling a shared library from swig interface
On Sat, Oct 22, 2016 at 01:16:12PM +0200, spalis wrote: > I tried to get the following class example from swig running: Please note that SWIG is no longer officially supported. In CHICKEN 5, all support will be dropped. 4.x still contains the SWIG support code but it hasn't been tested in a long time, and the upstream SWIG documentation appears severely bitrotted as well (it still talks about CHICKEN 2.x!) Cheers, Peter signature.asc Description: Digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Compiling a shared library from swig interface
On 2016-10-22 13:16, spalis wrote: > [...] > Error: (load) unable to load compiled module - ./example.so: undefined > symbol: _ZTV6Square: "./example.so" > [...] Hello, well, binutils tells us that $ c++filt _ZTV6Square vtable for Square So the shared object you built apparently does not link correctly against the C++ backend code you want to wrap. You may have to add some linker flags to the CHICKEN compiler command line to pull in necessary external libraries. You may also want to pass the --no-undefined option to the GNU linker when building the shared object (using csc ... -L -Wl,--no-undefined ...), which will instruct the linker to report this kind of error rather than deferring its detection to runtime :-) Ciao, Thomas -- When C++ is your hammer, every problem looks like your thumb. signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Compiling a shared library from swig interface
I tried to get the following class example from swig running: /* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 /* Move the shape to a new location */ void Shape::move(double dx, double dy) { x += dx; y += dy; } int Shape::nshapes = 0; double Circle::area() { return M_PI*radius*radius; } double Circle::perimeter() { return 2*M_PI*radius; } double Square::area() { return width*width; } double Square::perimeter() { return 4*width; } /* File : example.i */ %module example %{ #include "example.h" %} /* Let's just grab the original header file here */ %include "example.h" applying the following commands: swig -chicken -c++ -nounit example.i csc -I/usr/include/chicken -sv -c++ example.scm example_wrap.cxx -o example.so Everything worked fine and the so file has been generated. However, trying to load the library in the interpreter (csi) with (require 'example) gives the following error: Error: (load) unable to load compiled module - ./example.so: undefined symbol: _ZTV6Square: "./example.so" Hope someone can guide me, what went wrong. Stefan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users