Category "ctypes"

Python Ctypes - loading dll throws OSError: [WinError 193] %1 is not a valid Win32 application

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

use ctypes.py_object to implement array class in python

This is first part of code. from ctypes import py_object from typing import TypeVar, Generic T = TypeVar('T') class ArrayR(Generic[T]): def __init__(self

Pass char* array from c dll to python

I have simple dll with function which taks callback as parameter and calls it sometimes passing unsigned char* array. I want to use it in python. Here is dll so

how to obtain SeDebugPrivilege in Python?

How does one obtain SeDebugPrivilege in Python? I believe both the Ctypes api and PyWin32 are both individually capable of doing it, i don't care which API is u

How do I copy a part of bytearray to c_void_p-referenced memory and vice versa?

In the Python application, I have a bytearray with some data. My python code is called by some external native library (DLL/so/dylib) (using ctypes and its call

How to assign value to zero-length array defined by ctypes in Python3

Here I have a class defined like below, whose attribute data is a zero-length array. How to instantiate this class? class Frame(ctypes.Structure): _fields_

Python ctypes pass pointer in structure field to Fortran derived types

I want to make a variable-size array to pass to a Fortran DLL and get the result (by reference), so that I can get value directly. In the Fortran code, I use a

Python Ctypes: Convert returned C array to python list, WITHOUT numpy

I am using Python Ctypes to access some C library. One of the functions I connected to, returns const *double, which is actually an array of doubles. When I g

Why does ctypes.cast() appear to trigger a memory leak?

Using python 3.9.9 (on Windows 10), I've been experiencing 'Out of memory" related issues for an application that makes heavy use of ctypes. I was able to boil

OSError: [WinError 193] %1 is not a valid Win32 application while reading custom DLL in python with CTypes

I am trying to write code that wraps a C library in python. I am planning on using CTypes to do it and I used visual studio to compile my DLL. I started with a

Can't import dll module in Python

I've been stressin for a few days trying to compile a modified version of libuvc on windows and now that I've finally done it, I can't seem to load it on Python

Where does ctypes LoadLibrary() search for libs on OS X?

Where does ctypes LoadLibrary() search for a shared lib on Mac OS X? This works: LoadLibrary("/full/path/to/my_library.dylib") However, LoadLibrary("my_li