kopolov has asked for the wisdom of the Perl Monks concerning the following question:
These are the types of each parameter: TM_PageTranslation - C struct u32 - unsigned int u64 - unsigned long long int This is my typemap:TM_PageTranslation* findPageByEffective(u32 lpid, u32 pid, u64 EA);
(T_U_INT is defined in the default typemap) this is my XS code: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);
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:typedef struct TM_PageTranslation * T_PageTranslation; ... T_PageTranslation findPageByEffective(lpid, pid, EA) u32 lpid u32 pid u64 EA
How do I fixed 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); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlXS assignment from incompatible pointer type
by Anonymous Monk on Mar 22, 2016 at 23:40 UTC | |
by Anonymous Monk on Mar 23, 2016 at 01:13 UTC | |
by Anonymous Monk on Mar 23, 2016 at 10:14 UTC | |
by kopolov (Acolyte) on Mar 23, 2016 at 08:52 UTC |