Doubiman wrote:
I've got a function in a wx object that I'm writing XS for that
returns a another object, which doesn't inherit from any wx classes,
by value (not a pointer to object), meaning the O_WXOBJECT,
O_NON_WXOBJECT, T_PTROBJ and T_PTRREF typemaps give the error "cannot
convert 'wxWebViewDOMElementInfo' to 'const void *' in argument
passing" error.
Is there a 'right' / best way for returning objects by value from C++?
I figured it out. I didn't understand (and still don't fully) the way in
which the body of the XSUB affects the generated C. I knew I had to
return a pointer to the value to let Perl use it, but I hadn't gone
ahead and done that in the XSUB body because I thought the error I was
seeing was to do with the typemap, and wanted to do that first :-p I
ended up filling in a very simple:
wxWebViewDOMElementInfo *
wxWebView::HitTest(pos)
wxPoint pos
CODE:
RETVAL = new wxWebViewDOMElementInfo ();
*RETVAL = THIS->HitTest(pos);
OUTPUT:
RETVAL
...and now O_NON_WXOBJECT is perfectly acceptable. Like magic (a little
too much like it indeed). Hopefully this'll help out the next guy.
-- Ryan