Good method for storing C pointer?

Grant Munsey gmunsey at adobe.com
Sun Mar 5 21:42:31 EST 2000


I am creating a bunch of low lever C interfaces to some
in-house libraries. I want to keep several libraries
separate as modules in their own DLL files.

I have several kinds of 'cookies' that need to be
passed back into Python which will then be
given as parameters to Python covers for low level
'C' calls. An example would be Windows HWND
values.

Currently I define a new type for each of these cookies
so that I can do good parameter checking. Problem
is that some of the cookie types are used by multiple
modules ... which might or might not be loaded in a
particular app.

As I understand it you can't create a type multiple times
because you'll end up with multiple addresses for the
low level type structure ... and type compares will
fail.

So right now I have a separate module that defines all
the shared types. I don't like this ... would rather
the first module that needs a type define it and then
post the type structure address somewhere that other
modules can get at.

Anyone have a clean way to do this?





More information about the Python-list mailing list