in reply to Re: Help needed for XS on Perl v5.8.3
in thread Help needed for XS on Perl v5.8.3
Now when Perl v5.6.1 generates .c file from .xs file following code was generatedTYPEMAP const char * T_PV test_class * ANY OBJECT OUTPUT ANY OBJECT sv_setref_pv($arg, CLASS, (void *) $var); INPUT ANY OBJECT $var = ($type) SvIV((SV*)SvRV($arg));
On the other hand Perl v5.8.3 generated following codeXS(XS_Test_TestMethod) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Test::TestMethod(CLASS, param1)"); { char* CLASS = (char *)SvPV(ST(0),PL_na); pstruct * param1;
Can anybody please tell me why code generation is different for Perl v5.6.1 and Perl v5.8.3? I also doubt that code generated by Perl v5.8.3 may cause problem in my script when no valid reference address passed to the TestMethod. Can anybody kindly give me any pointers to overcome this problem?XS(XS_Test_TestMethod) { dXSARGS; if (items != 2) Perl_croak(aTHX_ "Usage: Test::TestMethod(CLASS, param1)"); { char* CLASS = (char *)SvPV_nolen(ST(0)); pstruct * param1 = (pstruct *) SvIV((SV*)SvRV(ST(1)));
|
|---|