This is my typemap file: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 trans.xs file header:TYPEMAP PageTranslation T_PTROBJ TM_InMemoryEntries T_PTROBJ TM_SlbEntry T_PTROBJ TM_TranslationEntry T_PTROBJ U64 T_UV
and I have these functions inside the XS file which fails (only a sample):#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
failing line:InMemoryEntries selectMemoryEntriesSet(type) U64 type InMemoryEntries getEntryByType(pageTranslation, entryType) PageTranslation pageTranslation U64 entryType SlbEntry getSlbEntry(pageTranslation) PageTranslation pageTranslation
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)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
In reply to perl XS and C struct (works) by kopolov
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |