I have a C-function which returns a struct data type with several items in it (size_t, char*, int, unsigned and other structs). When I call this function there is no output in python. After some googling I think the problem is that I didn't declare the data type in my interface file. But this turns out to be not that easy. What is the right approach: typemaps or just a simple typedef?
Can someone help me?
You need to %include the header first. You need the headers for the nested structs too, in dependency order!
After you've done that, Swig should automatically wrap the struct so that a call to your function will return a proxy object with the appropriate members.
A typemap is for when you want to change Swig's default behaviors.
Return Struct data type from C-function in Python via SWIG