Results for query "Python Mac ctypes"

Have C library call python function with ctypes

I have a DLL in c and meant for windows platforms which has a structure similar to the following:

C Structure

typedef struct some_struct {
int (_stdcall *function)(int arg1, int arg2);.}SOME_STRUCT;


I've defined a python ctypes structure to mimic this with the following

Python Structure

class SOME_STRUCT(Structure):
_fields_ = [('function', POINTER(CFUNCTYPE(c_int, c_int, c_int))),.

how to call C function in python without cdll

I am trying to create a simple script to test calling a C function in python script.There are solution that using ctypes (load cdll wrapper) but for my application that i will load those script (using micro python interpreter) on to a MCU and it wont have any system file.