This is my first attempt at undertaking a C extension module. I want to wrap an existing C library so I can call the functions from Python. There are only two functions I'm interested in calling. I did mess with Pyrex a bit and Swig, to no avail, so I turned to doing it by hand. Using the example in Programming Python, I did get the easier of the two functions working--only takes a string parameter. I'm stuck now on the other function and not sure how to wrap it, because it involves some structs. Here's a simplified version of the C: struct In { int x; char* s; ... (only primitive data types) }; struct Out { int y; char* s; ... (only primitive data types) }; Out* func(In* x, Out* y); So the function takes pointers to the two structs, and fills out the output struct and also returns the pointer to it. I would envision the Python looking like in = In() in.y = 1 in.s = "abc" ... out = func(in) maybe? Just no idea how to deal with the structs in the C extension module code. Any tips appreciated. Thanks, Chris
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4