[Insight-users] wrapping with cswig
Danial Saruji
DS_01 at web.de
Fri Apr 9 09:31:37 EDT 2010
Hi,
I'm interested in using cswig to make a c++ wrapping of a different program, and trying to understand how it works from the examples. As far as I got these are the steps required to wrap a c++ extension with cswig:
1) Create a xml description of the c++ code
2) Create the index
3) Create the cable/swig wrapper
4) Compile the original class and the created wrapper in a shared lib
5) Load it into python (or whatever)
This is what I do:
1. D:\CableSwig\bin\bin\Debug\gccxml -fxml-start=_cable_ -fxml=.\Debug\example.xml -DCSWIG -DCABLE_CONFIGURATION example.cpp
2. D:\CableSwig\bin\bin\Debug\cableidx .\Debug\example.xml .\Debug\example.idx
3. D:\CableSwig\bin\bin\Debug\cswig -ID:\PythonModules\Debug -ID:\CableSwig\CableSwig\SWIG\Lib -ID:\CableSwig\CableSwig\SWIG\Lib\python -v -module example -Cindex .\Debug\example.idx -o .\Debug\example_wrap.cxx -c++ -python .\Debug\example.xml
When reading the idx file, cswig throws an error message: error can not open {ds::Example} {example} {example1}
Any idea what I´m doing wrong? Is there maybe a detailed description of this process available? I couldn´t find much.
My example.cpp looks like this:
#include "example.h"
int ds::Example::fact(int n) {
if (n < 0){
return 0;
}
if (n == 0) {
return 1;
}
else {
return n * fact(n-1);
}
}
#ifdef CABLE_CONFIGURATION
namespace _cable_
{
const char* const group="example1";
namespace wrappers
{
typedef ds::Example example;
}
}
void cable_instantiate()
{
using namespace _cable_::wrappers;
sizeof(example);
}
#endif
Thanks and best regards,
Danial
___________________________________________________________
NEU: WEB.DE DSL für 19,99 EUR/mtl. und ohne Mindest-Laufzeit!
http://produkte.web.de/go/02/
More information about the Insight-users
mailing list