Re: Typemap AV reference to char **
[email protected] (Bill Moseley)
| Newsgroups | perl.xs |
|---|---|
| Message-ID | <CAKhN_m6oc2+TfXF-3J-V6cehXTZVgk8JA35UdfN0bAPdBqyarg@mail.gmail.com> |
Quick follow up: On Tue, Jul 17, 2012 at 7:05 AM, Bill Moseley <[email protected]> wrote: > > family( int count, char* names[], int ages[], char* family_name ); > > > [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? Thinking about this a bit more I realized that this specific constructor is only called ONCE per process. So, if I malloc names[] and ages[] I'm not sure it's a problem if they don't get freed. Does that simplify things? i.e. don't need to malloc a struct to hold these until DESTROY. Second, this is my first use of XS and C++, and in the simple tests I've been doing XS is setting up a "THIS" for me. If I need to malloc a struct that holds names[], ages[], and the address returned by the C++ constructo ("my_cpp_object"), if my new method returns this struct then is that what THIS ends up as? That is, instead of THIS->method() I would then do THIS->my_cpp_object->method(). Am I making this harder that it is? -- Bill Moseley [email protected]