Hi, Still on the perlXS issue (damn, its complicated) This is my header file:
#include <TM_TranslationAPI.h> #include "TM_DefaultParams.h" // This data structure holds an array of address and the number of act +ual addresses typedef struct TM_TranslationAdresses{ u64 addressCount; u64 addresses[10*MAX_NUM_OF_ALIASES]; } TM_TranslationAdresses; TM_TranslationAdresses * findEAsForGivenRAAndContext( u64 raAddress, u64 lpid, u64 pid);
As you can see - contains only one structure and one function

This is my XS file (trans.xs):

#include "/usr/include/stdio.h" #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "TM_TranslationsDB.h" MODULE = trans PACKAGE = trans PROTOTYPES: ENABLE TM_TranslationAdresses * findEAsForGivenRAAndContext(raAddress, lpid, pid) u64 raAddress u64 lpid u64 pid

this is the typemap I use:

TYPEMAP TM_TranslationAdresses * T_PTROBJ u64 T_U_LONG_LONG ################################################## INPUT T_U_LONG_LONG $var = (unsigned long long int)SvUV($arg) ################################################## OUTPUT T_U_LONG_LONG sv_setuv($arg, (UV)$var);

this is the trans.pm file I use:

package trans; use 5.010001; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( ); our $VERSION = '0.01'; require XSLoader; XSLoader::load('trans', $VERSION); 1;

and finally - this is the simple perl program I try to test everything:

#!/usr/bin/perl -w use lib '/gpfs/haifa-p4/08/tm/team/hagaih/perlWithC/trans/blib/arch/au +to/trans'; use lib '/gpfs/haifa-p4/08/tm/team/hagaih/perlWithC/trans/blib/lib'; use trans; use Math::BigInt; use Data::Dumper; my $lpid=0; my $pid=5; my $raAddress=Math::BigInt->new("0x00000000_01F560C0"); my $result=trans::findEAsForGivenRAAndContext($raAddress, $lpid, $pid) +; print $result->addressCount;

everything compiles great. I know the C code is working since I wrote a simple C program to verify it.

but when I run the perl program I get this error:

Can't locate object method "addressCount" via package "TM_TranslationA +dressesPtr" at test_translations.pl ...
Please ... will appreciate any help on the matter

In reply to perlXS - missing object methods 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.