[IronPython] PyBonjour through Ctypes

Clemens Nylandsted Klokmose clemensklokmose at gmail.com
Sun Sep 12 16:48:09 CEST 2010

I am experimenting with getting a Python library running in IronPython that
relies on PyBonjour (http://code.google.com/p/pybonjour/).
PyBonjour is a pure python library interfacing with the systems bonjour
installation. I am completely unexperienced with CTypes, so what I am
proposing now might seem naïve.

At the top of the pybonjour.py is code looking like this:
if sys.platform == 'win32':
    # Need to use the stdcall variants
    _libdnssd = ctypes.windll.dnssd
    _CFunc = ctypes.WINFUNCTYPE

IronPython's sys.platform evaluates to 'cli', so I have tried to change the
check to if sys.platform == 'win32' or sys.platform == 'cli':
This seems to work, but everytime a C function is called now, Python
complains that theres an argument too much.
E.g. TypeError: CFunctionType() takes at most 2 arguments (3 given). My
suggestion is that ctypes.WINFUNCTYPE in IronPython might be a wrong value?
(In IronPython it seems to always be 0x000000000000002B, whereas in CPython
the value varies)

Does anyone have an idea of how to go about this?

It should be noted that I have pybonjour running with the standard CPython
on Windows.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100912/454ff420/attachment.html>

More information about the Ironpython-users mailing list