Question.. I'm working to wrap a vendor c library in Perl. I'm a newbie.. my typemap currently file contains one line "struct RECORD_DETAILS * T_PTR". It seems I've got things working using the below XS code, all compiles and the c functions I call are returning true.(I haven't done extensive testing though, but these are encouraging results for a newbie)
Within my XS file I have something like below. This first function takes a pointer and sets the pointer to an opaque data structure. I've read in a couple spots that using T_PTR to store a reference to a C data structure isn't a good, and that you should use T_PTROBJ or T_PTRREF. It seems most documentation advises to use the T_PTROBJ, but I'm a bit daunted by that and wanted thought start with T_PTRREF.(thinking it'd be simpler and more crude)
Most of the documentation I'm finding covers T_PTROBJ with examples, but not T_PTRREF. Any advice/tips on how to go about changing a typemap for a C datastructure to T_PTRREF and what sorts of changes I'll need to make within my XS code?
thanks,
marc
int record_create( opener_name, record_details )
char * opener_name
struct RECORD_DETAILS * record_details
CODE:
RETVAL = record_create(opener_name, &record_details);
OUTPUT:
record_details
RETVAL
int record_save(record_details)
struct RECORD_DETAILS * record_details
CODE:
RETVAL = record_save(record_details);
OUTPUT:
record_details
RETVAL
