Re: [Pyobjc-dev] NSDocument based app
Brought to you by:
ronaldoussoren
From: Peter M. <zig...@po...> - 2002-11-06 10:53:13
|
On Wednesday, November 6, 2002, at 09:19 PM, Ronald Oussoren wrote: > > On Wednesday, Nov 6, 2002, at 10:52 Europe/Amsterdam, Peter Montagner > wrote: >>> The last argument is problematic: void pointers currently require >>> manual assistance. We can at least support automatic translation >>> from None to a NULL pointer. >> >> So (void *) arguments are broken? Hmm... well I can avoid that in my >> example app by using the print panel rather than the sheet. The panel >> doesn't require a call back. There are a few things that use the >> (void *)contextInfo paradigm though, so we should probably fix it. >> What's the current scheme? >> > Not really broken, just not working as you want :-) Problem is that it > hard to automaticly translate from a Python object to a void*: Do you > want to pass the object itself (like you probably want to do here) or > should the object be translated to some native type (like you'd want > to do with 'int write(int fd, void* buf, int len)'). > > The current scheme is that you'll have to manually write methods that > do the right thing. But, I'll probably add a mechanism to get this > type of void* arguments to work without writing C code. Doing a quick grep of the AppKit.framework headers reveals that there are about 40 methods with a (void *) argument and a few that return a (void *). Almost all of those that use (void *) as an argument use it in the same way as my method, as an extra bit of user data. Even if nobody uses it, PyObjC will still choke on all of those methods. If I understand this correctly of course. The Foundation.framework has about 20 but most of those aren't the kind of thing you'd call from Python. Peter |