how to passing parameters from pyobjc to c lib

Issue #241 closed
cheung cheung
created an issue

my dylib is written in c language. like

CFDataRef foo(CFDictionaryRef arg) { // NSLog(@"the argument is %@", arg); return nil }

and I want to call foo within python script.

foo.py

import CoreFoundation,ctypes

dict = CoreFoundation.CFDictionaryCreate(None, ('aap', 'noot', 'mies', 'wim'), ('monkey', 'nut', 'missy', 'john'), 4, CoreFoundation.kCFTypeDictionaryKeyCallBacks, CoreFoundation.kCFTypeDictionaryValueCallBacks)

dll = ctypes.CDLL('path/cfoo.dylib')

here is the problem

dll.foo(dict)

I don't know how to call dll.foo() and passing any CF parameters.

Comments (5)

  1. Log in to comment