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