[PyQt] SIP beginner question(s) -- how to wrap typedef struct?

Robin M Baur rmb62 at cornell.edu
Fri Aug 19 15:28:44 BST 2011


Hi list,

I'm just getting started with SIP and have a few questions that I
haven't yet found the answers to in the docs. Pointers back to the
docs are welcome if I've missed something obvious. A standalone
representative snippet of my header file is at the bottom of this
email.

1. Mainly, I'm searching for the correct combination of directives to
wrap a typedef struct statement, assuming that's possible. (Is it?) I
can wrap typedefs and structs individually, but I've been stymied in
the attempt to do both together. I've tried both doing nothing and
putting a %TypeHeaderCode directive inside the struct definition;
either way, SIP just complains of a syntax error on the line with the
opening brace. Should I be looking at %MappedType? Something else?

2. Is %UnitCode the correct directive for wrapping #pragma and
#define? If not, what is?

3. My (Windows) compiler (MSVC 9.0) doesn't balk at UINT32, but SIP
understandably does ("UINT32 is undefined."). MSVC 9 inexplicably
doesn't ship stdint.h, so I can' t pull the obvious trick of
#including stdint.h and replacing UINT32 with uint32_t everywhere.
Does anyone know of a workaround for getting a UINT32 wrapped with
SIP?

Thanks for any advice.

-- Robin

test.h:
---------------------

#pragma once

#define API_OK 0

typedef struct
{
    unsigned short     port;
    UINT32       baud;
} SERIAL_INIT_TS;

typedef struct
{
    SERIAL_INIT_TS  serialData;
    char            camConfigFile[MAX_PATH+1];
    UINT32    bpp;
} CAMOPEN_PARAM_TS;


More information about the PyQt mailing list