On Thu, Jan 25, 2018 at 9:16 AM, Jason Qian via Python-list <python-list@python.org> wrote: > Hi, > > I have following code that works fine on windows. > > InvocationCB=WINFUNCTYPE(None, c_char_p, c_int) > submit = lib.submit > submit.argtypes = [ctypes.c_void_p, c_void_p,InvocationCB] > submit.restype = ctypes.c_int > > def handleResponse(message, code): > print('--- handleResponse ---') > print(message) > print(code) > > class GSPythonDriver(object): > def submif(self,methodname) > invm_fn = InvocationCB(handleResponse) > lib.submit(self.obj,methodname,invm_fn) > > How can I do this on the Linux ?
If you're doing a lot of "got this C code, wanna call it from Python", I recommend looking into Cython and building a wrapper. Should be a lot less fiddly - and a lot less fragile - than playing with ctypes for every call you want to make. ChrisA -- https://mail.python.org/mailman/listinfo/python-list