Re: [Swig] Dealing with C++ smart pointers in C#

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Swig] Dealing with C++ smart pointers in C#

Dave Dribin
On Oct 10, 2005, at 3:49 PM, William S Fulton wrote:
> Hi Dave
>
> I've put together my auto_ptr typemaps into an example. Actually, I've
> only ever used out typemaps, so they are tried and tested, however,
> I've also put together the in typemaps too. They allow one to use the
> same proxy class for methods that take an auto_ptr, plain pointer,
> reference or passed by value.

Hi William,

I am only going to use out typemaps, as well.  I've played around with
your code, and it looks like it'll work.  My only concern is that it
was tied to the particular language we're swigging to.  If I add Ruby,
Perl, or Python, I need a separate typemap for each language.  Where as
if use an %extend, I don't have to worry about it.  The problem with
%extend is one has to be written for each method.  I may play around
with macros to see if there's a way to automate that.

BTW, is there any way to have the PROXYCLASS be the same as TYPE, by
default?  I am not using auto_ptr's of templates, so TYPE and
PROXYCLASS end up being the same:

SWIG_AUTO_PTR_TYPEMAPS(Foo, Foo)

There's no such thing as default arguments for SWIG macros, is there?

Thanks for you help!

-Dave



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Swig] Dealing with C++ smart pointers in C#

William S Fulton
Dave Dribin wrote:

> On Oct 10, 2005, at 3:49 PM, William S Fulton wrote:
>> Hi Dave
>>
>> I've put together my auto_ptr typemaps into an example. Actually, I've
>> only ever used out typemaps, so they are tried and tested, however,
>> I've also put together the in typemaps too. They allow one to use the
>> same proxy class for methods that take an auto_ptr, plain pointer,
>> reference or passed by value.
>
> Hi William,
>
> I am only going to use out typemaps, as well.  I've played around with
> your code, and it looks like it'll work.  My only concern is that it was
> tied to the particular language we're swigging to.  If I add Ruby, Perl,
> or Python, I need a separate typemap for each language.  Where as if use
> an %extend, I don't have to worry about it.  The problem with %extend is
> one has to be written for each method.  I may play around with macros to
> see if there's a way to automate that.
>
You could use swig -xml to get a dump of all the methods and use the xml
to construct your %extend code to feed into swig on a second invocation
when you generate wrappers for the target language.

> BTW, is there any way to have the PROXYCLASS be the same as TYPE, by
> default?  I am not using auto_ptr's of templates, so TYPE and PROXYCLASS
> end up being the same:
>
> SWIG_AUTO_PTR_TYPEMAPS(Foo, Foo)
>
> There's no such thing as default arguments for SWIG macros, is there?
>
The macros support varargs so you could do something with that. Macro
varargs seem quite powerful, but I'm not that familiar with them, but
you might be able to conjure up something. Why don't you just have
another macro which calls the one above?

William


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...