in reply to Re: Inline C : assembler errors!
in thread Inline C : assembler errors!

thanks for spotting the typo. it still failed to compile and it still fails at the assembler stage. many of the assembler messages are :

8(%rdi)' is not a valid 32 bit base/index expression
yet i am on a 64b opteron. all the perl packages are 64b. could it be that another flag is needed to tell the assembler this?

anyway, the XS file is :

#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "INLINE.h" void inc_refcnt(SV * sv ) { SvREFCNT_inc(sv); } SV * get_refcnt(SV * sv) { return newSVuv(svREFCNT(sv)); } MODULE = exp_pl_aa05 PACKAGE = main PROTOTYPES: DISABLE void inc_refcnt (sv) SV * sv PREINIT: I32* temp; PPCODE: temp = PL_markstack_ptr++; inc_refcnt(sv); if (PL_markstack_ptr != temp) { /* truly void, because dXSARGS not invoked */ PL_markstack_ptr = temp; XSRETURN_EMPTY; /* return empty stack */ } /* must have used dXSARGS; list context implied */ return; /* assume stack size is correct */ SV * get_refcnt (sv) SV * sv
the resulting C code is :
/* * This file was generated automatically by xsubpp version 1.9508 from + the * contents of exp_pl_aa05.xs. Do not edit this file, edit exp_pl_aa05 +.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "exp_pl_aa05.xs" #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "INLINE.h" void inc_refcnt(SV * sv ) { SvREFCNT_inc(sv); } SV * get_refcnt(SV * sv) { return newSVuv(svREFCNT(sv)); } #line 24 "exp_pl_aa05.c" XS(XS_main_inc_refcnt) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: main::inc_refcnt(sv)"); SP -= items; { SV * sv = ST(0); #line 23 "exp_pl_aa05.xs" I32* temp; #line 35 "exp_pl_aa05.c" #line 25 "exp_pl_aa05.xs" temp = PL_markstack_ptr++; inc_refcnt(sv); if (PL_markstack_ptr != temp) { /* truly void, because dXSARGS not invoked */ PL_markstack_ptr = temp; XSRETURN_EMPTY; /* return empty stack */ } /* must have used dXSARGS; list context implied */ return; /* assume stack size is correct */ #line 46 "exp_pl_aa05.c" PUTBACK; return; } } XS(XS_main_get_refcnt) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: main::get_refcnt(sv)"); { SV * sv = ST(0); SV * RETVAL; RETVAL = get_refcnt(sv); ST(0) = RETVAL; sv_2mortal(ST(0)); } XSRETURN(1); } #ifdef __cplusplus extern "C" #endif XS(boot_exp_pl_aa05) { dXSARGS; char* file = __FILE__; XS_VERSION_BOOTCHECK ; newXS("main::inc_refcnt", XS_main_inc_refcnt, file); newXS("main::get_refcnt", XS_main_get_refcnt, file); XSRETURN_YES; }

Replies are listed 'Best First'.
Re^3: Inline C : assembler errors!
by syphilis (Archbishop) on Oct 03, 2006 at 07:17 UTC
    Nothing obvious (to me, anyway) in the C or XS files.

    Does this happen only with Inline::C ?
    Do you get the same sort of behaviour with a "Hello World" type of Inline::C script ? (ie a script that doesn't explicitly use any of the perl API functions.)
    Do you get the same sort of behaviour whenever you build a perl extension ?

    Cheers,
    Rob