From: Marcelo M. <mm...@ac...> - 2005-12-14 17:49:22
|
Did you include the class declaration before the template directive?, ie: %include "std_vector.i" %{ #include "Object.h" %} %include "Object.h" %template(ObjectVector) std::vector<Object *>; Marcelo Dave Dribin wrote: > I've got an API that returns a vector of object pointers: > > std::vector<Object *> getObjects(); > > I'm trying to get this to work in C#, Ruby, Perl, and Python, but I'm > having quite some difficulty. I am using std_vector.i: > > %include "std_vector.i" > %template(ObjectVector) std::vector<Object *>; > > However, the Ruby wrapper generates a compiler error similar to: > > error: no matching function for call to 'Object::Object(Object*&)' > > And if I try C#, I can compile the wrapper, but then ObjectVector.cs > fails to compile with an error like: > > ObjectVector.cs(59,17): error CS0208: Cannot take the address of, > get the size of, or declare a pointer to a managed type `Object' > > The generated C# code is: > > public Object * this[int index] { ... } > > So, clearly, I've hit a use case that causes problems. Is there a > technical reason why a vector of object pointers is difficult? Or > are the typemaps just in need of work in this area? Hopefully it's > the latter, so I can try and work out the issues. > > Thanks, > > -Dave > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user |