[Insight-users] wrapping with cswig

Danial Saruji DS_01 at web.de
Tue Apr 13 05:29:26 EDT 2010


Hi,

solved my problem. It seems that you need to give as -Cindex input file a file containing the path to the idx file. I created a master index file (.mdx) containing the path and it worked.

bst rgds,
Danial

-----Ursprüngliche Nachricht-----
Von: Danial Saruji <DS_01 at web.de>
Gesendet: 09.04.2010 15:31:37
An: insight-users at itk.org
Betreff: wrapping with cswig

>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
___________________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


More information about the Insight-users mailing list