As you can see - contains only one structure and one function#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);
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:
Please ... will appreciate any help on the matterCan't locate object method "addressCount" via package "TM_TranslationA +dressesPtr" at test_translations.pl ...
In reply to perlXS - missing object methods by kopolov
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |