defining module constants

Rob Shortt <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
Hello,

I'm creating some python bindings to a C library.  I've defined
everything from the lib's header file in my pxd file and would like to
expose many of the defined enums in my pyrex module, not as members of a
class, but toplevel to my module.

For example, in my pxd file I have stuff like:

cdef extern from "directfb.h":
    ctypedef enum DFBResult:
        DFB_OK
        DFB_FAILURE
        DFB_INIT
        DFB_BUG

and so on...

What can I add to my pyx file so that my resulting module will have
these, like:

import directfb
print directfb.DFB_OK


Please don't tell me I have to redefine or reassign them all in my pyx
file, but some equvalent to PyModule_AddIntConstant(m, "DFB_OK", DFB_OK)
would be ok.

Thanks,
-Rob

_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH/mIKJ+LOBHZ1wCsRAo6VAJoC+XnGJIO2gTeJSrbLf0uLtshRtwCbByIN
DccDhD5XQ44Mo4iRxx5aRgQ=
=6NZc
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.