in reply to Typemap in Perl XS

No. 'void **' could actually mean any number of things.

Is it supposed to be a pointer to the first item in an array of 'void *' values? Or is the array just one such pointer? What is/are the 'void *' pointer(s) supposed to be pointing at? How is the array or the thing(s) being pointed at supposed to be allocated? Initialized?

What is your design for how to map between this 'void **' value in C and some Perl data structure?

- tye        

Replies are listed 'Best First'.
Re^2: Typemap in Perl XS (no)
by sohan123 (Novice) on Aug 14, 2012 at 14:20 UTC
    Thanks for the reply. My perl script is passing the address of a variable which will holds the string. The Perl XS program will populate the string and that string should then be available to perl script.
      Is your C API really using a char **? That would mean that library has its own memory allocator. There is no way to do a "char **" with the default perl typemap. You will have to write real C/XS code (CODE:/PPCODE:) section, or write real C code in your supplementary typemap in your module. ANSI prototype mode with default perl typemap wont work for "char **"s.

      Please read How do I post a question effectively? and post more background on what you are trying to do, and code or C header examples of what you have done so far.

      That sounds like 'char *' not 'void **'.

      You need to be clearer on how "the string" should be allocated, at least.

      - tye        

        Yes..Thats fine. What i want to know is that how should i pass pointer to a pointer to a Perl XS subroutine? Even if i use char**, it breaks at run time saying "undefined symbol: XS_unpack_charPtrPtr".