0
|
1 dyncall python bindings
|
5
|
2 (C) 2007-2016 Daniel Adler.
|
|
3 Dec 4, 2007: initial
|
|
4 Mar 22,2016: brought up to dyncall 0.9
|
|
5
|
0
|
6
|
7
|
7 BUILD/INSTALLATION
|
|
8 ------------------
|
4
|
9
|
|
10 1) make sure dyncall is built and libraries/headers are in include paths or
|
|
11 CFLAGS points to them, etc.
|
|
12
|
7
|
13 2) Build and install this gem with:
|
|
14 python setup.py install
|
4
|
15
|
|
16
|
0
|
17 API
|
4
|
18 ---
|
0
|
19
|
|
20 libhandle = load(libpath)
|
5
|
21 funcptr = find(libhandle, symbolname)
|
|
22 call(funcptr, signature, ...)
|
0
|
23
|
7
|
24
|
0
|
25 SIGNATURE FORMAT
|
7
|
26 ----------------
|
0
|
27
|
|
28 is a formated string
|
|
29
|
|
30 format: "xxxxx)y"
|
|
31
|
|
32 x is positional parameter-type charcode
|
|
33
|
5
|
34 'B' C++: bool <- Python: PyBool
|
|
35 'c' C: char <- Python: PyInt (range checked)
|
|
36 's' C: short <- Python: PyInt (range checked)
|
0
|
37 'i' C: int <- Python: PyInt
|
5
|
38 'j' C: long <- Python: PyLong
|
0
|
39 'l' C: long long <- Python: PyLongLong
|
5
|
40 'f' C: float <- Python: PyFloat (cast to single precision)
|
|
41 'd' C: double <- Python: PyFloat
|
0
|
42 'p' C: void* <- Python: PyCObject
|
5
|
43 'Z' C: const char* <- Python: PyString
|
0
|
44
|
|
45 y is result-type charcode
|
|
46
|
7
|
47 'v' C: void
|
|
48 'B' C++: bool -> Python: PyBool
|
|
49 'c' C: char -> Python: PyInt
|
|
50 's' C: short -> Python: PyInt
|
|
51 'i' C: int -> Python: PyInt
|
|
52 'j' C: long -> Python: PyLong
|
|
53 'l' C: long long -> Python: PyLongLong
|
|
54 'f' C: float -> Python: PyFloat (cast to double precision)
|
|
55 'd' C: double -> Python: PyFloat
|
|
56 'p' C: ptr -> Python: PyCObject encapsulating a void*
|
|
57 'Z' C: const char* -> Python: PyString
|
5
|
58
|
0
|
59
|
|
60 BUGS
|
4
|
61 ----
|
0
|
62
|
|
63 * build on osx/ppc - link error i386 something... [MacPython 2.4]
|
|
64
|
|
65 solution:
|
4
|
66 installation of latest python for os x (MacPython 2.5)
|
0
|
67
|
|
68 build log:
|
|
69
|
|
70 python setup.py install
|
|
71 running install
|
|
72 running build
|
|
73 running build_py
|
|
74 creating build
|
|
75 creating build/lib.macosx-10.3-fat-2.4
|
|
76 copying pydc.py -> build/lib.macosx-10.3-fat-2.4
|
|
77 running build_ext
|
|
78 building 'pydcext' extension
|
|
79 creating build/temp.macosx-10.3-fat-2.4
|
|
80 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
|
|
81 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
|
|
82 /usr/bin/ld: for architecture i386
|
|
83 /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)
|
|
84 /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)
|
|
85 running install_lib
|
|
86 copying build/lib.macosx-10.3-fat-2.4/pydcext.so -> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages
|
|
87
|