[Pythonmac-SIG] Calldll

Jack Jansen jack@oratrix.nl
Sun, 22 Aug 1999 22:53:14 +0200


Recently, David Ascher <da@ski.org> said:
> > struct {
> > 	WindowPtr	win;
> > 	int		x, y;
> > };
> 
> Am I correct that the C function in question returns a pointer to such a
> struct?  (in other words, that a struct is used to return multiple
> values?)

Yes, there's a few places where either (a) you have to build such a
struct, (b) macos returns one or (c) there's a long-lived object with
such a form that you keep alive to communicate between your
application and MacOS (sort of a poor mans object).

> I'm not sure I understand this bit (and alas I'm in a rush today).  With
> calldll, I'm pretty sure everything is doable =). (calldll is not
> something I'm using for my stuff because I'm working on CE, where calldll
> is not yet done -- and hard to write -- there are lots of chips to
> support).

Note that when we Maccies talk "calldll" we mean a completely
different module than Sam Rushings calldll for Windows. Same idea, but 
different interface and implementation. Still, something useable with
the one should be useable with the other.

I think I'll just wait until you feel ready to release your module and 
then I'll have a look at how to incorporate the functionality I
want. There's quite a few Python object types that are basically
straight wrappers around a corresponding C API object in both MacOS
and Windows, and all of these share the same semantics for passing
from and to C. And as PyArg_Parse already has ("O!", typeobject, &obj) 
and ("O&", conversionroutine, &ptr) I think I should be able to
convince Guido that, say, ("O+", typeobject, &ptr) where the
conversion routine is looked up in the type object would be a nifty
thing to have. Then exporting this functionality to Python (directly
through your module, or through struct) shouldn't be too hard.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm