williams has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use XS to wrap a C++ class that is accessible only through a separate, smart pointer class. So it appears that Perl objects should store a pointer to a smart pointer object. The double dereference necessary to call the methods I'm after is going to lead to miles of this.
I'd much rather the XS compiler somehow automate all of this repetition, given something more along these lines.bool SmartPtr::isValid() CODE: RETVAL=(*THIS)->isValid(); OUTPUT: RETVAL const char *name SmartPtr::name() CODE: RETVAL=(*THIS)->name(); OUTPUT: RETVAL
Is there some sneaky XS directive or typemap game that will get me there with minimal fuss? The best alternative I can come up with is to write an xsubpppp.bool SmartPtr::isValid() const char * SmartPtr::name()
Thanks,
Jim
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using XS To Wrap A C++ Smart Pointer
by tsee (Curate) on Sep 28, 2009 at 21:09 UTC | |
Re: Using XS To Wrap A C++ Smart Pointer
by Anonymous Monk on Sep 28, 2009 at 23:25 UTC | |
Re: Using XS To Wrap A C++ Smart Pointer
by williams (Beadle) on Sep 29, 2009 at 18:39 UTC |
Back to
Seekers of Perl Wisdom