ctypes
C function passes a pointer and a length, and a Python callback needs to make an array and assign it
I\'m wrapping a C library that uses callbacks as external memory allocators.Basically, instead of doing malloc and free itself, it exposes several callbacks for making buffers of specified sizes.Hooki[详细]
2023-02-15 04:01 分类:问答Can't retieve a value from a C function in a Python script but can in console
I am using python (Pydev) to communicate with stepper motors with a DLL using ctypes. I am trying to retrieve the position of the motor. The thing is that if I type the script in line by line in the c[详细]
2023-02-13 16:01 分类:问答How to handle array of strings (char **) in ctypes in a 64-bit environment?
I\'m using ctypes to work with libgphoto2 in Python. The following code succeeds on a 32-bit machine, but fails with a Segmentation Fault on a 64-bit machine (Linux, Ubuntu):[详细]
2023-02-13 04:49 分类:问答How can I use a DLL from Python
I am trying to load a DLL in Python, I want to use its eConnect() function using ctypes What I know from the source code of the DLL:[详细]
2023-02-13 04:29 分类:问答How do I build a python string from a raw (binary) ctype buffer?
I\'m playing with Python and ctypes and I can\'t figure out how to resolve this problem. I call to a C function which fills a raw binary data. My code looks like this:[详细]
2023-02-12 13:35 分类:问答How do I build a python string from a ctype struct?
I\'m using ctypes and I\'ve defined this struct in order to pass parameters class my_struct(ctypes.Structure):[详细]
2023-02-12 11:54 分类:问答Is it acceptable to subclass c_void_p in ctypes?
I am interfacing with a library that returns opaque pointers. Is it acceptable to subclass开发者_高级运维 c_void_p to represent this in ctypes and provide for type checking for this particular flavor[详细]
2023-02-11 22:25 分类:问答Python interfacing with C library - How to have a null c pointer
I have the following old c code. const char *c[3]; c[0] = \"ABC\"; c[1] = \"EFG\"; c[2] = 0; c_function(c);[详细]
2023-02-11 04:00 分类:问答How do I pass large numpy arrays between python subprocesses without saving to disk?
Is there a good way to pass a large chunk of data between two python subprocesses without using the disk? Here\'s a cartoon example of what I\'m hoping to accomplish:[详细]
2023-02-10 23:01 分类:问答ctypes: printf returns length which is int instead of the string
I\'m using ctypes and loading msvcrt.dll in Python 2.5. >>> from ctypes import * >>> libname = \'msvcrt.dll\'[详细]
2023-02-10 11:02 分类:问答