[Pyobjc-dev] Passing objects between PyObjc and SWIG
Brought to you by:
ronaldoussoren
|
From: Kyle J. <osm...@gm...> - 2008-03-20 10:27:30
|
I have a C library (Cairo) which accesses Core Graphics. I've wrapped
it up in a SWIG binding so I can easily access it from Python.
Everything is great when calling functions in it and passing around
objects from Apple's CoreGraphics Python library (which they generated
with SWIG as well). However, when I switch from using Apple's
CoreGraphics to using PyObjc libraries (AppKit and Quartz) and try to
pass a CGContextRef from a PyObjC lib to the SWIG-wrapped library I
get errors because SWIG doesn't recognize the PyObjc wrapping of the
object.
So basically, I need to code something which converts the PyObjc
internal type to a SWIG-understandable internal type.
Here's the problem: I can't figure out where to dig around in PyObjc
to find the representation of "core-foundation class CGContextRef." Is
this something which is being generated automatically and not
hand-coded somewhere?
A semi-related question: if I'm getting objects of type PyObjCPointer
when I do not import the PyObjc Quartz lib, but then I get objects of
"actual" types ("core-foundation class CGContextRef" in this case)
when I include the PyObjc Quartz lib, is that an indication that I
_must_ include the Quartz lib?
>From my digging so far, I think that just dealing with PyObjCPointers
and SWIG would be relatively simple; I just have that nagging idea
that PyObjCPointers are results of errors though. :)
Thanks!
--
Kyle Johnson
|