callback.h #ifdef CALLBACK_EXPORTS #define CALLBACK_API __declspec(dllexport) #else #define CALLBACK_API __declspec(dllimport) #endif extern "C" { typedef struct myst { int a; int b; int c; } myst_args; typedef void callBackFunc (struct myst); CALLBACK_API int __stdcall create_callback(callBackFunc* funcIn); CALLBACK_API int __stdcall call_callback(); } class Ccallback { public: Ccallback(callBackFunc *pFuncIn); static void fireCallback(); private: static callBackFunc *pFunc; }; callback.cpp #include "stdafx.h" #include "callback.h" // This is the constructor of a class that has been exported. // see callback.h for the class definition Ccallback::Ccallback(callBackFunc *pFuncIn) { pFunc = pFuncIn; return; } void Ccallback::fireCallback() { myst args; args.a = 1; args.b = 2; args.c = 3; (*pFunc) (args); } CALLBACK_API int __stdcall create_callback(callBackFunc* funcIn) { Ccallback temp(funcIn); return 0; } CALLBACK_API int __stdcall call_callback() { Ccallback::fireCallback(); return 0; } callBackFunc* Ccallback::pFunc = 0; My Python code is: import ctypes class myst_args(ctypes.Structure): _pack_ = 1 _fields_ = [ ('a', ctypes.c_int), ('b', ctypes.c_int), ('c', ctypes.c_int) ] callback_t = ctypes.CFUNCTYPE(None, myst_args) def onGetEvent(args, **kws): print "a =", args.a print "b =", args.b print "c =", args.c lib = ctypes.cdll.LoadLibrary("callback.dll") _CB_GET = callback_t(onGetEvent) lib.create_callback(_CB_GET) lib.call_callback()