Shame it doesn't work with my compiler :(

Actually doing the expansion isn't hard:

C:\test>type expand_malloc.c #include "EXTERN.h" #include "perl.h" char *p = malloc( 10 ); C:\test> cl -E -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -Wp64 -fp:prec +ise -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DWIN64 -DCONSER +VATIVE -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONT +EXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -D +NDEBUG -Ox -GL -Wp64 -fp:precise -DVERSION=\"1.76\" -DXS_VERSION= +\"1.76\" "-IC:\Perl64\lib\CORE" -DHAS_PPPORT_H expand_malloc.c >jun +k.txt

And if you load up the output file junk.txt, and wade you way down to line: 203,525 (Yes! That really is line: two hundred and three thousand five hundred and twenty five!), you get:

[203524 lines omitted :)] #line 3 "expand_malloc.c" char *p = malloc( 10 );

which probably means I've got the wrong set of defines on the command line :(

Update: Of course. I forgot to include XSUB.h:

... #line 4 "expand_malloc.c" char *p = (*(*Perl_IMem_ptr(((PerlInterpreter *)Perl_get_context())))- +>pMalloc)((*Perl_IMem_ptr(((PerlInterpreter *)Perl_get_context()))), +(10));

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: XS replacing my c library, not compatible with OS threads by BrowserUk
in thread XS replacing my c library, not compatible with OS threads by patcat88

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.