About 50 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 ctypes. Some s...

  2. python - What is the difference between ctypes.CDLL () and ctypes.cdll ...

    Apr 11, 2021 · What is the difference between ctypes.CDLL () and ctypes.cdll.LoadLibrary ()? Asked 4 years, 9 months ago Modified 1 year, 3 months ago Viewed 23k times

  3. python - How to use C++ classes with ctypes? - Stack Overflow

    I'm just getting started with ctypes and would like to use a C++ class that I have exported in a dll file from within python using ctypes. So lets say my C++ code looks something like this: class

  4. 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.

  5. 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 numeric …

  6. 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, 2 months ago Modified 3 years, 7 months ago Viewed 84k times

  7. python - how to type hint ctypes.POINTER (ctypes.c_int) - Stack Overflow

    May 14, 2023 · ctypes.POINTER is a constructor that creates an object (a pointer) for the ctypes data type (c_int) passed as its argument. So your linter most likely rejects ctypes.POINTER(ctypes.c_int) …

  8. python - ImportError: DLL load failed while importing _ctypes : The ...

    Aug 23, 2022 · Python 3.9.17 (base environment) 2. CTypes considerations [Python.Docs]: ctypes - A foreign function library for Python is a library (initially started by Thomas Heller, then adopted by …

  9. 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 object, …

  10. Comparing performance of python and ctypes equivalent code

    Nov 2, 2022 · I tried to compare the performance of both Python and Ctypes version of the sum function. I found that Python is faster than ctypes version. Sum.c file: int our_function(int num_numbers, int …