translating linked list with SIP
    Marian Thomsen 
    marian.th at outlook.de
       
    Thu Feb 25 12:59:14 GMT 2021
    
    
  
Hello,
I'm having difficulties translating linked list from given c++ API to python.
I have a struct (DataType) holding some data (const unsigned char* data) and the size of this data. Then I have a struct ListNode that has a void* data, that should point to a DataTypeObj.
Where I'm stuck:
DataType and ListNode can be translated with SIP, but I suspect something goes wrong when passing the address of dataTypeObj to listNodeObj.data.
The address of dataTypeObj in hex format is the address the debugger shows me, therefore the ID should be right.
But the content is not. dataTypeObj.size accessed from listNodeObj is garbage.
This is my header file:
typedef struct ListNode {
    void* data;
    struct ListNode *next;
    struct ListNode *prev;
}ListNode;
typedef struct DataType {
    const unsigned char *data;
    int   numocts;
}DataType;
// to debug
void displayDataType(DataType &dataType, void *dataTypePtr);
void displayListNode(ListNode &listNode);
and this is my .sip file:
struct ListNode {
%TypeHeaderCode
#include <llist.h>
%End
    void *data;
    struct ListNode *next;
    struct ListNode *prev;
} ;
struct DataType {
%TypeHeaderCode
#include <llist.h>
%End
   const unsigned char *data;
   int   numocts;
} ;
// to debug
void displayDataType(DataType &dataType, void *dataTypePtr);
void displayListNode(ListNode &listNode);
Does someone have and idea?
Thanks in advance!
M.T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210225/f4a27851/attachment.htm>
    
    
More information about the PyQt
mailing list