D
Daniel Berger
Hi all,
Solaris 10
swig 1.3.21
Sun Studio 11
I'm trying my hand at SWIG here. I've read over
http://www.swig.org/Doc1.3/Ruby.html, but I'm confused as to how to
setup the interface file so that I get a class. I don't want a
module, if possible.
Anyway, given the following .h file:
// polygon.h
class Rectangle {
int x, y;
public:
void set_values(int,int);
int area();
};
int Rectangle::area(){
return x * y;
}
void Rectangle::set_values (int a, int b) {
x = a;
y = b;
}
I created a simple interface file (polygon.i):
%module polygon
Then I ran swig like this:
swig -c++ -ruby polygon.i
That generates the file, but it only contains a Polygon module.
There's no Rectangle class or methods.
What am I doing wrong here? And, is there any way to just generate a
Rectangle class without a Polygon module?
Thanks,
Dan
PS - I tried to find the tutorial that Lyle Johnson gave back in 2002,
but I can't find a good link. Anyone have one handy?
Solaris 10
swig 1.3.21
Sun Studio 11
I'm trying my hand at SWIG here. I've read over
http://www.swig.org/Doc1.3/Ruby.html, but I'm confused as to how to
setup the interface file so that I get a class. I don't want a
module, if possible.
Anyway, given the following .h file:
// polygon.h
class Rectangle {
int x, y;
public:
void set_values(int,int);
int area();
};
int Rectangle::area(){
return x * y;
}
void Rectangle::set_values (int a, int b) {
x = a;
y = b;
}
I created a simple interface file (polygon.i):
%module polygon
Then I ran swig like this:
swig -c++ -ruby polygon.i
That generates the file, but it only contains a Polygon module.
There's no Rectangle class or methods.
What am I doing wrong here? And, is there any way to just generate a
Rectangle class without a Polygon module?
Thanks,
Dan
PS - I tried to find the tutorial that Lyle Johnson gave back in 2002,
but I can't find a good link. Anyone have one handy?