Goodbye XS Segfault

I've been playing about with XS in Perl the past few days and I've been driven mad by my code segfaulting when I tried to set an error callback.

I've just found out what the cause of the problem is and it's totally obvious now I've found it.

Basically, when I was creating my XS Perl object I was calling New instead of Newz to allocate memory for it.

Calling Newz means that the area of code I am setting is zero'd first, so my callback now correctly checks to see it needs to allocate a new SV or reuse an existing one. Previously it was seeing a value in there and trying to reuse a non existant variable.

XS is very hard going, but the rewards are worth it sometimes. Hopefully the result of this work will be a CPAN release of my new module when it's completed.

Entered: 2004-01-02 01:09:38
Modified: 2004-01-02 01:10:04

Rob's Other Blog Entries

See other blog entries for January 2004, or an index of all blog entries.