|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Problems with shared_ptr and PythonHi
I am trying to wrap shared_ptr code and I have run into some problems. Running the following code through swig gives an exception: %module example %include <boost_shared_ptr.i> SWIG_SHARED_PTR(Foo, Foo) %inline %{ #include <boost/shared_ptr.hpp> using boost::shared_ptr; struct Foo {}; void test1(shared_ptr<Foo> f) {} //void test2(boost::shared_ptr<Foo> f) {} %} My command line looks like: swig -IC:/boost_1_40_0 -python example.i and I am using swigwin-1.3.40 and boost-1.40.0 The exception I get looks like this: $ swig -IC:/boost_1_40_0 -python example.i example.i(5): Error: Syntax error in input(1). Obviously I am doing something wrong but cannot figure out what the problem is. Does anybody have a minimum example that should work? Incidentally, trying the example fro the test suite (li_boost_shared_ptr.i) gives the same exception. Best regards Andreas ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Problems with shared_ptr and Pythonandreas.held@... wrote:
> Hi > > I am trying to wrap shared_ptr code and I have run into some problems. > Running the following code through swig gives an exception: > > %module example > > %include <boost_shared_ptr.i> > SWIG_SHARED_PTR(Foo, Foo) > > %inline %{ > #include <boost/shared_ptr.hpp> > using boost::shared_ptr; > struct Foo {}; > void test1(shared_ptr<Foo> f) {} > //void test2(boost::shared_ptr<Foo> f) {} > %} > > My command line looks like: > swig -IC:/boost_1_40_0 -python example.i swig -c++ -python example.i > > and I am using swigwin-1.3.40 and boost-1.40.0 > > The exception I get looks like this: > > $ swig -IC:/boost_1_40_0 -python example.i > example.i(5): Error: Syntax error in input(1). > > Obviously I am doing something wrong but cannot figure out what the problem is. Does anybody have a minimum example that should work? Incidentally, trying the example fro the test suite (li_boost_shared_ptr.i) gives the same exception. > I can't replicate that error using swig-1.3.40, try the correct command line options given above. William ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
|
|
|
Re: Problems with shared_ptr and Pythonandreas.held@... wrote:
> Hi William > > Thank you for your quick reply. Sorry for my mistake in the command line. As you pointed out, the correct command line should be: > swig -c++ -python example.i > > Still, even with that command line I do get the same error. I now stronly suspect that something is wrong with my boost installation. It is impossible for SWIG to be affected by your boost installation unless you tell it to via an include path (the -I option). However, there might be a problem when your c++ compiler compiles the generated code, as that will then use your boost installation. > Anyway, I have now found a way around my problem by using > %template > I don't know what you are doing wrong, but the SWIG_SHARED_PTR macro invokes the %template directive for you. I think you need to post your non-working example again. William ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |