Re: [Pyobjc-dev] Wrapping GetLocationID from IOUSBLib
Brought to you by:
ronaldoussoren
From: Brendan S. (eTRIX) <Bre...@eT...> - 2009-06-23 07:07:25
|
Ronald Oussoren wrote: > > On 23 Jun, 2009, at 3:23, Brendan Simon (eTRIX) wrote: >> I had a quick look at ctypes and not sure if it can be used to access >> ObjC variables, functions, etc. I'm not sure if there is a way to build >> a C (or C++) wrapper around the ObjC code and then use ctypes. I >> presume it's possible but it's getting complicated :( > > Neither wrapping using ctypes nor wrapping using PyObjC will be easy. > You access functionality of "objects" from IOKit using function pointers > in the "object" struct. That should be easy enough to write in ctypes, > but PyObjC has no real support for that. On the other hand, PyObjC has > support for CFString and other CoreFoundation types while ctypes hasn't. > > BTW. IOKit is not an Objective-C based framework, but is a plain C > framework that makes use of CoreFoundation. Thanks Ronald. I've had a look at libusb-1.0.2 it is written in C and makes IOKit calls :) PyUSB (0.x) uses ctypes to interface to libusb-0.1.12. PyUSB has just started a new 1.0 branch to use libusb-1.x.y, and as such there is no release yet. So it seems that the best solution for me is to take the libusb code, and either extend/modify it to provide the info I need. I can use PyUSB or my own ctype interface to get a python interface. So I think I will skip the PyObjC exercise for now, although I really like the project. If IOKit support was added to PyObjC that would be really really useful :) Thanks for everyone's help, Brendan. |