|
Re: Smartpointer and references: msg#00179programming.swig
On Mon, 27 Sep 2004, Felix Domke wrote: > i'm having a usual smartpointer class, let's call it "SmartPtr". > > then i have > > class Foo; > typedef SmartPtr<Foo> FooPtr; > > class Foo > { > static Foo *instance; > public: > static RESULT getInstance(FooPtr &ptr) { ptr = instance; return 0; } > /*... plus error checking */ > }; > > Now i'd like to use something like > > instance = FooPtr() > Foo.getInstance(instance) > > in python, but i get > > "TypeError: Expected a pointer" on the "getInstance" call. > > Is there something special to account when using references at all? I'm confused. Your typedef should not give you a FooPtr proxy class (you need to use %template). However, there should be an unrelated FooPtr class in Python, due to the way proxy classes are implemented (every class has a corresponding class named SomethingPtr). However, this should not have an argumentless constructor. What is "instance", i.e., what is the result of "print instance"? Josh -- Joshua L. Cherry, Ph.D. NCBI/NLM/NIH (Contractor) jcherry@xxxxxxxxxxxxxxxx _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: SWIG runtime libs/Python distutils combo on Mac: 00179, Bob Ippolito |
|---|---|
| Next by Date: | Re: Wrapping __declspec(dllimport) and __stdcall: 00179, William S Fulton |
| Previous by Thread: | Smartpointer and referencesi: 00179, Felix Domke |
| Next by Thread: | SWIG+Perl+C free() error and zero pointer on very simple script Bug # 1035817: 00179, Bryga 66 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |