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

Reply via email to