Re: [Pyobjc-dev] Wrapping GetLocationID from IOUSBLib
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2009-06-23 06:40:23
|
On 23 Jun, 2009, at 3:23, Brendan Simon (eTRIX) wrote: > > > I have made the assumption that anybody using PyObjC is probably > familiar with Objective C and therefore familiar with OS X libraries > (as > that's the most prevalent ObjC platform) -- possibly an optimistic > assumption ??? I'd also expect that most members of this list are familiar with OSX libraries, but not with all libraries. The IO Registry is a rather low-level library and I'd guess that most developers don't have to use it. The set of libraries on OSX, or any modern platform, is rather huge and I'd expect that most developers have a superficial knowledge of what's available and more detailed knowledge of what they actually expect to use (I know that IOKit exists if I ever need to do low-level hardware access, but as I haven't needed that functionality that's about it). > > 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. Ronald |