Typemap AV reference to char **

[email protected] (Bill Moseley)
Newsgroups perl.xs
Message-ID <CAKhN_m6DtUwPHvrCTq5qVXU0i_S_NcAp1TNVjjyuyh7_RQAgTw@mail.gmail.com>
It's been many years since working with XS, so I apologize for my
ignorance. :)

I have a C++ constructor with a signature like this:

family( int count, char* names[], int ages[], char* family_name );

My question is what is the easiest way to interface with methods with this
kind of signature?


I'd be very happy to have typemaps handle those (and thus make my XS simply
declare the constructor), but seems like I need to malloc the new arrays.
 And that would mean I'd need to free those which I assume I could do right
after the constructor above returns.[1]  Or, if I have some reasonable
bounds on the total number of elements can I just a fixed size array on the
stack?

Could someone please provide an example -- or maybe point me to existing
code on CPAN?

Thanks,



[1] I guess I'd better see if family() holds on to the addresses of names[]
and ages[] after returning.   Hum, if I don't know that maybe I need to
malloc my own "object" so I can free those on DESTROY.   Is that right?

-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.