Hello,

I have a C function that I need to call from Perl.
It goes a little something like this:

char *work(char *inString){
        char *stringToReturn = (char *)malloc(2*sizeof(inString));

        while(*inString){
                // do some work on stringToReturn
                inString++;
        }
        return stringToReturn;
}

The thing is, since I can't free stringToReturn, I need to have it garbage collected in the perl side. I have tried creating an SV * with the newSVpv* methods, passing in the stringToReturn and then freeing it, but I am always getting segmentation faults.

This should be pretty simple, but I just can't get it to work.

Thank you for your time.
Paulo F. Andrade
[EMAIL PROTECTED]




Reply via email to