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; }

In reply to Re^2: Inline C : assembler errors! by Anonymous Monk
in thread Inline C : assembler errors! by Anonymous Monk

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.