Hi there,
The PyQt docs for QLibrary include the following common-usage snippet:
Code:
typedef void (*MyPrototype)(); MyPrototype myFunction = (MyPrototype) myLib.resolve("mysymbol"); if (myFunction) myFunction();
That is not terribly useful, as is, within Python. What I'm wondering is what the Python equivalent would be? This is what I've tried:
Code:
def getKeyboardHooks(self): f = kcLib.resolve('installhook') if not f: print 'DEBUG: no resolve() installhook', kcLib.errorString() else: print 'DEBUG:', f try: f(self.winId()) except Exception as (errstr): logger.exception(errstr)
On STDOUT I get the else print statement, and the log file gets the following exception: "TypeError: 'sip.voidptr' object is not callable". It seems I need the Python equivalent of a typedef cast but I have no idea how to do this. Web searches on Python typedef and sip.voidptr have yielded very little information, although there is a sip.cast(obj, type) method that looks promising? I don't know. Thanks in advance to any PyQt coders who respond.