----- Original Message ----- From: "Miah Gregory" <[EMAIL PROTECTED]>
> > > Another problem is how I should return the two results. It would be nice > > > if I could return them in the same way as the perl subroutine. Looks as > > > if I need to set the return type as 'void', and use Inline_Stack_*, but > > > again, how do I pass back a 'string' that contains NUL's. > > Does the above sound approximately accurate? To me it does - though I can't say anything intelligent about the issue surrounding NULL's. I've even taken to using the stack when I have only one value to return. I do that mainly for uniformity. Seems to me that it's as fast as any other method. If you push it as a 'sv_2mortal()', then you don't have to worry about memory leaks. > Do you have any suggestions as to how I should be allocating memory? AFAIR, > the docs suggest to /not/ use malloc, but I'm not sure what I should be using > in preference. > For dynamic memory allocation use New(), Newz(), or Newc() - and Safefree() instead of free(). Btw, there are many perfectly functional modules around with XS code containing 'malloc' and 'free'. I'm not sure precisely under which circumstances it becomes an issue. (Btw, the first arument to New() can be any int - value not important.) > > > Where can I find out more about things like newSVpvf and the rest of > > > these macros/functions? > See 'perldoc perlapi'. Also worth taking a look at 'perldoc perlclib'. Cheers, Rob