[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Compiling a shared library from swig interface
From: |
spalis |
Subject: |
[Chicken-users] Compiling a shared library from swig interface |
Date: |
Sat, 22 Oct 2016 13:16:12 +0200 |
User-agent: |
mu4e 0.9.9.5; emacs 24.4.1 |
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] Compiling a shared library from swig interface,
spalis <=