Skip to content

Tag: ctypes

Wrapping a C++ library using msl-loadlib in python

I am currently writing a wrapper for a C++ library. The library is a 32-bits dll file and I’m using 64-bits so I’m using msl-loadlib. I have a problem wrapping a function that has pointer parameters. Here is the header of the function in C++ and here the wrapper I wrote When I call Client.getMeasu…

Pointer argument passing in python ctypes

I have the following c function. This function returns outbuf, the output length is unknown before calling the function so the function receives a pointer to the length as an argument outbuf_len, also the caller is responsible to free outbuf. I want to get the result of this function from python, so I started…

Python ctype Structure/Union Issue

So I am trying to do a bitmap. The data comes from a device as a 32bit number and each bit means something. So I was playing around with ctype Structures and Unions. Trying to do the classic int in and it maps to the individual bits. and this output. This first line is the 32bit value and the rest