[Insight-users] wrapping with cswig

Luis Ibanez luis.ibanez at kitware.com
Thu Apr 15 21:49:24 EDT 2010


Hi Danial,

Thanks a lot for sharing the solution
that you found to this problem.

That's the Open Source Spirit   !!



    Regards,


           Luis


-----------------------------------------------------------
On Tue, Apr 13, 2010 at 5:29 AM, Danial Saruji <DS_01 at web.de> wrote:

> 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
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100415/2d019c49/attachment.htm>


More information about the Insight-users mailing list