in reply to Re^3: XS replacing my c library, not compatible with OS threads
in thread XS replacing my c library, not compatible with OS threads

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.