Steve Hay <[EMAIL PROTECTED]> writes: > >I've found that the following scheme (a variation on my original >attempt) also seems to work: > > MY_STRUCT *my_struct; > SV *sv; > Newz(1, my_struct, 1, MY_STRUCT); > sv = newSVuv(PTR2UV(my_struct)); > >(with a "Safefree(my_struct)" later on). > >I believe this is OK because *Perl* has now allocated the struct's >memory so it doesn't get reused until I ask Perl to free it. Is that >correct, or have I just struck lucky with it working so far?
That is correct. > >Are they are pros/cons of the two schemes that work? There are more than two that work. The "pro" of putting the struct in the string part of SV is you don't need to remember to do the Safefree(). > >- Steve > > > >------------------------------------------------ >Radan Computational Ltd. > >The information contained in this message and any files transmitted with it are >confidential and intended for the addressee(s) only. If you have received this >message in error or there are any problems, please notify the sender immediately. >The unauthorized use, disclosure, copying or alteration of this message is strictly >forbidden. Note that any views or opinions presented in this email are solely those >of the author and do not necessarily represent those of Radan Computational Ltd. The >recipient(s) of this message should check it and any attached files for viruses: >Radan Computational will accept no liability for any damage caused by any virus >transmitted by this email.