in reply to Re^4: Passing NULL pointer through XS without "Use of uninitialized value in subroutine entry"
in thread Passing NULL pointer through XS without "Use of uninitialized value in subroutine entry"

Can you explain to me exactly the difference between T_OBJECT and T_PTROBJ?

T_OBJECT is not a standard type. It doesn't exist in the core typemap. (I checked 5.6.1, 5.8.0, 5.8.6 and 5.8.8). If you provided me with your module-specific typemap, I'll explain what it does.

You should use T_PTROBJ or T_PTRREF, according to perlxs.

For inputs of type T_PTROBJ, the XSUB calls the XS equivalent of UNIVERSAL::isa on the argument to make sure the arguemnt is defined and a blessed reference of the appropriate class or of a descendant of the appropriate class. Outputs of this type of blessed.

For inputs of type T_PTRREF, the XSUB only checks if the argument is a reference. It doesn't care if the reference is blessed or not. Outputs of this type are not blessed.

I've verified that 123 and 'abc' are not accepted.

Only if XSRETURN_UNDEF returns immediately (as opposed to setting the return value). I don't know if it does, and you said you didn't know what XSRETURN_UNDEF does. Move RETVAL = my_c_create_bar(foo); into the "then" clause of the if to be safe.

  • Comment on Re^5: Passing NULL pointer through XS without "Use of uninitialized value in subroutine entry"
  • Select or Download Code