0
|
1 dyncall python bindings
|
|
2 (C) 2007 Daniel Adler.
|
|
3 2007 04. December
|
|
4
|
|
5 API
|
|
6
|
|
7 libhandle = load(libpath)
|
|
8 funcptr = find(libhandle, symbolname )
|
|
9 call( funcptr,signature, ... )
|
|
10
|
|
11 SIGNATURE FORMAT
|
|
12
|
|
13 is a formated string
|
|
14
|
|
15 format: "xxxxx)y"
|
|
16
|
|
17 x is positional parameter-type charcode
|
|
18
|
|
19 'b' C++: bool <- Python: PyBool
|
|
20 'i' C: int <- Python: PyInt
|
|
21 'l' C: long long <- Python: PyLongLong
|
|
22 'p' C: void* <- Python: PyCObject
|
|
23 's' C: const char* <- Python: PyString
|
|
24
|
|
25 y is result-type charcode
|
|
26
|
|
27 'v' void
|
|
28 'i' int -> PyInt
|
|
29 'l' long -> PyLong
|
|
30 'p' ptr -> PyCObject encapsulating a void*
|
|
31 'f' float -> PyFloat (upcast to double)
|
|
32 'd' double -> PyFloat
|
|
33
|
|
34 BUGS
|
|
35
|
|
36 * build on osx/ppc - link error i386 something... [MacPython 2.4]
|
|
37
|
|
38 solution:
|
|
39 installation of latest pytho for os x (MacPython 2.5)
|
|
40
|
|
41 build log:
|
|
42
|
|
43 python setup.py install
|
|
44 running install
|
|
45 running build
|
|
46 running build_py
|
|
47 creating build
|
|
48 creating build/lib.macosx-10.3-fat-2.4
|
|
49 copying pydc.py -> build/lib.macosx-10.3-fat-2.4
|
|
50 running build_ext
|
|
51 building 'pydcext' extension
|
|
52 creating build/temp.macosx-10.3-fat-2.4
|
|
53 gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -I../../../dyncall -I../../../dynload -I/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4 -c pydcext.c -o build/temp.macosx-10.3-fat-2.4/pydcext.o
|
|
54 gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.4/pydcext.o -L../../../dyncall -L../../../dynload -ldyncall_s -ldynload_s -lstdc++ -o build/lib.macosx-10.3-fat-2.4/pydcext.so
|
|
55 /usr/bin/ld: for architecture i386
|
|
56 /usr/bin/ld: warning ../../../dyncall/libdyncall_s.a archive's cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (can't load from it)
|
|
57 /usr/bin/ld: warning ../../../dynload/libdynload_s.a archive's cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (can't load from it)
|
|
58 running install_lib
|
|
59 copying build/lib.macosx-10.3-fat-2.4/pydcext.so -> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages
|
|
60
|