About 880,000 results
Open links in new tab
  1. python - ctypes - Beginner - Stack Overflow

    I have the task of "wrapping" a c library into a python class. The docs are incredibly vague on this matter. It seems they expect only advanced python users would implement …

  2. How to return array from C++ function to Python using ctypes

    Feb 15, 2013 · I am using ctypes to implement a C++ function in Python. The C++ function should return a pointer to an array. Unfortunately I haven't figured out, how to access the array in …

  3. python - What is the difference between ctypes.CDLL () and …

    Apr 11, 2021 · Everything is well explained in [Python.Docs]: ctypes - A foreign function library for Python: class ctypes. CDLL (name, mode=DEFAULT_MODE, handle=None, …

  4. python - wrapping ctypes.Structure inside a class - Stack Overflow

    Oct 29, 2024 · I want to be able to pass a structure to some c-code and am using ctypes.structure. I have a simple working example that takes an input array and squares the …

  5. How do I convert a Python list into a C array by using ctypes?

    How do I convert a Python list into a C array by using ctypes? Asked 15 years, 1 month ago Modified 3 years, 6 months ago Viewed 84k times

  6. python - How to pack and unpack using ctypes (Structure <-> str ...

    If I use struct to define a binary structure, the struct has 2 symmetrical methods for serialization and deserialization (pack and unpack) but it seems ctypes doesn't have a straightforward way …

  7. Python ctypes definition for c struct - Stack Overflow

    Implementing the ctypes struct as suggested by Roland didn't work - the returned values were garbage, I never worked out why as I pursued a python based implementation of lilbil's answer.

  8. c - Python Ctypes - loading dll throws OSError: [WinError 193] %1 …

    Aug 1, 2019 · I have tried to run an exemple of a python code that gets a function from a library using ctypes. The exemple can be found here. I followed the instruction and beside one minor …

  9. Wrapping a C library in Python: C, Cython or ctypes?

    Dec 22, 2009 · We've used ctypes quite successfully to talk to vendor-supplied DLLs for various pieces of hardare (e.g. oscilloscopes) but I wouldn't necessarily pick ctypes first for talking to a …

  10. How to use memory allocated by C malloc in Python (ctypes)

    Mar 22, 2024 · For a callback, be careful not to use ctypes.c_char_p or ctypes.c_wchar_p for the pointer type. Those are special ctypes types that convert the value to a Python bytes or str …