On Sep 24, 2004, at 10:18 AM, Scott T. Hildreth wrote:

On Thu, 2004-09-23 at 16:04, Nick Ing-Simmons wrote:
- the XS code from h2xs

CLI * cli_parse(argc, argv) int argc char ** argv

...I changed that to 'char * &argv'

this will be interpreted as something that wants to pass the address of one string by reference.


while it will be passed as a char**, it will not be the char*[] (array of char *) that is actually desired. you can see that in the code that gets generated (you already posted it, i won't repeat it).


With 'char ** argv',

xsubpp expects that you have supplied code to handle the charPtrPtr type in the way that you want. but you didn't.



perl arrays know their length, and subroutines know how many items are on the stack. passing an array and its length is very non-perlish. i'd bind that function to take the argv array on the stack, in the same manner as Nick mentioned earlier (the SomeFunc() example), so you could use it like this:


  $cli = Package::Cli::parse (@ARGV);

you could even fetch @ARGV as a global if you wanted to go for real simplicity.


-- "Ghostbusters" is the best movie of this decade. -- Neal, circa 1996, referring to a movie released in 1984.



Reply via email to