Hi there,
I'm a newbie to perlXS.
I have a C code which contains different structs
typedef struct {
EntryType type;
EntryIndex index;
} TM_TranslationEntry;
typedef struct {
u64 EA, VA, RA;
u8 pageSize;
u32 numOfEntries;
TM_TranslationEntry* entries;
u32 modificationSet;
} TM_PageTranslation;
typedef struct {
TM_InMemoryEntry* entries;
u32 numOfEntries;
} TM_InMemoryEntries;
typedef struct {
u64 slbee;
u64 slbev;
} TM_SlbEntry;
This is my typemap file:
TYPEMAP
PageTranslation T_PTROBJ
TM_InMemoryEntries T_PTROBJ
TM_SlbEntry T_PTROBJ
TM_TranslationEntry T_PTROBJ
U64 T_UV
This is my trans.xs file header:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include "TM_TranslationAPI.h" <--- include for the C code
typedef struct TM_PageTranslation * PageTranslation
typedef struct TM_InMemoryEntries * InMemoryEntries
typedef struct TM_SlbEntry * SlbEntry
typedef struct TM_TranslationEntry * TranslationEntry
MODULE = trans PACKAGE = trans
PROTOTYPES: ENABLE
and I have these functions inside the XS file which fails (only a sample):
InMemoryEntries
selectMemoryEntriesSet(type)
U64 type
InMemoryEntries
getEntryByType(pageTranslation, entryType)
PageTranslation pageTranslation
U64 entryType
SlbEntry
getSlbEntry(pageTranslation)
PageTranslation pageTranslation
failing line:
Error: 'InMemoryEntries' not in typemap in trans.xs, line 167
Error: 'InMemoryEntries' not in typemap in trans.xs, line 172
Error: 'SlbEntry' not in typemap in trans.xs, line 176
I want to note one thing:
prior to the functions which fails due to typemap issues, there are functions with PageTranslation which seems to pass (compiler does not give any errors/warning about them). As you can see, PageTranslation is also defined in the typemap.
What am I doing wrong?
****
update - found my mistake
typemap naming should contain the names I chose for the struct and not the struct themselves
(InMemoryEntries instead of TM_InMemoryEntries)