Mercurial > pub > dyncall > bindings
annotate python/pydc/README.txt @ 28:edbbd467f50a
python binding:
- update to dyncall 1.1
- Python 3 support (supports both, Python 2 and 3)
- using the Capsule API over PyCObject, when available
- support for python unicode strings (for both, Python 2 and 3)
- doc cleanup
ruby binding:
- doc cleanup
author | Tassilo Philipp |
---|---|
date | Tue, 07 Apr 2020 21:16:37 +0200 |
parents | 681db37a300c |
children | 6cc2b7fc7ea2 |
rev | line source |
---|---|
0 | 1 dyncall python bindings |
28 | 2 Copyright 2007-2016 Daniel Adler |
3 2018-2020 Tassilo Philipp | |
4 | |
5 Dec 4, 2007: initial | |
6 Mar 22, 2016: update to dyncall 0.9, includes breaking sig char changes | |
7 Apr 19, 2018: update to dyncall 1.0 | |
8 Apr 7, 2020: update to dyncall 1.1, Python 3 support, using the Capsule | |
9 API, as well as support for python unicode strings | |
5 | 10 |
0 | 11 |
7 | 12 BUILD/INSTALLATION |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
13 ================== |
4 | 14 |
15 1) make sure dyncall is built and libraries/headers are in include paths or | |
16 CFLAGS points to them, etc. | |
17 | |
10 | 18 2) Build and install this extension with: |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
19 |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
20 python setup.py install |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
21 |
28 | 22 Building a wheel package isn't supported, currently. |
4 | 23 |
24 | |
0 | 25 API |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
26 === |
0 | 27 |
28 libhandle = load(libpath) | |
5 | 29 funcptr = find(libhandle, symbolname) |
30 call(funcptr, signature, ...) | |
0 | 31 |
7 | 32 |
0 | 33 SIGNATURE FORMAT |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
34 ================ |
0 | 35 |
36 is a formated string | |
37 | |
38 format: "xxxxx)y" | |
39 | |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
40 x is positional parameter-type charcode, y is result-type charcode |
0 | 41 |
28 | 42 SIG | FROM PYTHON 2 | FROM PYTHON 3 @@@ | C/C++ | TO PYTHON 2 | TO PYTHON 3 @@@ |
43 ----+------------------------------------+------------------------------------+---------------------------------+------------------------------------+----------------------------------- | |
44 'v' | | | void | | | |
45 'B' | PyBool | PyBool | bool | PyBool | PyBool | |
46 'c' | PyInt (range checked) | PyInt (range checked) | char | PyInt | PyInt | |
47 'C' | PyInt (range checked) | PyInt (range checked) | unsigned char | PyInt | PyInt | |
48 's' | PyInt (range checked) | PyInt (range checked) | short | PyInt | PyInt | |
49 'S' | PyInt (range checked) | PyInt (range checked) | unsigned short | PyInt | PyInt | |
50 'i' | PyInt | PyInt | int | PyInt | PyInt | |
51 'I' | PyInt | PyInt | unsigned int | PyInt | PyInt | |
52 'j' | PyLong | PyLong | long | PyLong | PyLong | |
53 'J' | PyLong | PyLong | unsigned long | PyLong | PyLong | |
54 'l' | PyLongLong | PyLongLong | long long | PyLongLong | PyLongLong | |
55 'L' | PyLongLong | PyLongLong | unsigned long long | PyLongLong | PyLongLong | |
56 'f' | PyFloat (cast to single precision) | PyFloat (cast to single precision) | float | PyFloat (cast to double precision) | PyFloat (cast to double precision) | |
57 'd' | PyFloat | PyFloat | double | PyFloat | PyFloat | |
58 'p' | PyUnicode/PyString/PyLong | PyUnicode/PyBytes/PyLong | void* | Py_ssize_t | Py_ssize_t | |
59 'Z' | PyUnicode/PyString | PyUnicode/PyBytes | const char* (UTF-8 for unicode) | PyString | PyUnicode | |
0 | 60 |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
61 |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
62 TODO |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
63 ==== |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
64 |
28 | 65 - signature suffixes used to indicate calling conventions are not supported yet! |
66 - not sure if returning 'p' is working, creating PyCObject, check and write test code @@@ | |
67 - callback support | |
5 | 68 |
0 | 69 |
70 BUGS | |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
71 ==== |
0 | 72 |
73 * build on osx/ppc - link error i386 something... [MacPython 2.4] | |
74 | |
75 solution: | |
4 | 76 installation of latest python for os x (MacPython 2.5) |
0 | 77 |
78 | |
28 | 79 EXAMPLE BUILD |
80 ============= | |
81 | |
82 $ python setup.py install | |
0 | 83 running install |
84 running build | |
85 running build_py | |
86 creating build | |
87 creating build/lib.macosx-10.3-fat-2.4 | |
88 copying pydc.py -> build/lib.macosx-10.3-fat-2.4 | |
89 running build_ext | |
90 building 'pydcext' extension | |
91 creating build/temp.macosx-10.3-fat-2.4 | |
92 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 | |
93 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 | |
94 /usr/bin/ld: for architecture i386 | |
95 /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) | |
96 /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) | |
97 running install_lib | |
98 copying build/lib.macosx-10.3-fat-2.4/pydcext.so -> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages | |
99 |