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.


In reply to Re^5: Passing NULL pointer through XS without "Use of uninitialized value in subroutine entry" by ikegami
in thread Passing NULL pointer through XS without "Use of uninitialized value in subroutine entry" by kscaldef

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.