Hi there, I have this function in C:
TM_PageTranslation* findPageByEffective(u32 lpid, u32 pid, u64 EA);
These are the types of each parameter: TM_PageTranslation - C struct u32 - unsigned int u64 - unsigned long long int This is my typemap:
TYPEMAP T_PageTranslation T_PTROBJ u64 T_U_LONG_LONG u64 * T_OPAQUEPTR u32 * T_OPAQUEPTR u32 T_U_INT ################################################## INPUT T_U_LONG_LONG $var = (unsigned long long int)SvUV($arg) ################################################## OUTPUT T_U_LONG_LONG sv_setuv($arg, (UV)$var);
(T_U_INT is defined in the default typemap) this is my XS code:
typedef struct TM_PageTranslation * T_PageTranslation; ... T_PageTranslation findPageByEffective(lpid, pid, EA) u32 lpid u32 pid u64 EA
When I run the make command I get the following warning: "trans.c:470: warning: assignment from incompatible pointer type" line 470 int rans.C is this:
XS(XS_trans_findPageByEffective); /* prototype to pass -Wmissing-proto +types */ XS(XS_trans_findPageByEffective) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 3) croak_xs_usage(cv, "lpid, pid, EA"); { u32 lpid = (unsigned int)SvUV(ST(0)); u32 pid = (unsigned int)SvUV(ST(1)); u64 EA = (unsigned long long int)SvUV(ST(2)); T_PageTranslation RETVAL; RETVAL = findPageByEffective(lpid, pid, EA); <--- This is line 470 ST(0) = sv_newmortal(); sv_setref_pv(ST(0), "T_PageTranslation", (void*)RETVAL); } XSRETURN(1); }
How do I fixed this?

In reply to perlXS assignment from incompatible pointer type (works) by kopolov

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.