annotate python/pydc/README.txt @ 34:2682a627168c

- breaking changes: * restrict 'Z' conversions to immutable types * restrict 'p' to mutable types (and handles)
author Tassilo Philipp
date Sun, 12 Apr 2020 19:37:37 +0200
parents baf087cf5971
children 75fe1dec0eb4
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
34
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
10 Apr 11, 2020: support for getting loaded library path
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
11 Apr 12, 2020: breaking change: restrict 'Z' conversions to immutable types
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
12 and 'p' to mutable types (and handles)
5
bf5625bb6f05 - brought python binding up to dc v0.9
cslag
parents: 4
diff changeset
13
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
7
4fd959b3df78 - python binding readme clarifications
cslag
parents: 5
diff changeset
15 BUILD/INSTALLATION
16
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
16 ==================
4
4c5019f00f5b - python binding cleanup
cslag
parents: 0
diff changeset
17
4c5019f00f5b - python binding cleanup
cslag
parents: 0
diff changeset
18 1) make sure dyncall is built and libraries/headers are in include paths or
4c5019f00f5b - python binding cleanup
cslag
parents: 0
diff changeset
19 CFLAGS points to them, etc.
4c5019f00f5b - python binding cleanup
cslag
parents: 0
diff changeset
20
10
6493c9ed4b33 - ruby and python binding readme updates
cslag
parents: 7
diff changeset
21 2) Build and install this extension with:
16
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
22
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
23 python setup.py install
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
24
28
edbbd467f50a python binding:
Tassilo Philipp
parents: 24
diff changeset
25 Building a wheel package isn't supported, currently.
4
4c5019f00f5b - python binding cleanup
cslag
parents: 0
diff changeset
26
4c5019f00f5b - python binding cleanup
cslag
parents: 0
diff changeset
27
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 API
16
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
29 ===
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 libhandle = load(libpath)
5
bf5625bb6f05 - brought python binding up to dc v0.9
cslag
parents: 4
diff changeset
32 funcptr = find(libhandle, symbolname)
bf5625bb6f05 - brought python binding up to dc v0.9
cslag
parents: 4
diff changeset
33 call(funcptr, signature, ...)
29
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents: 28
diff changeset
34 free(libhandle)
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35
7
4fd959b3df78 - python binding readme clarifications
cslag
parents: 5
diff changeset
36
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 SIGNATURE FORMAT
16
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
38 ================
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 is a formated string
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 format: "xxxxx)y"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
16
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
44 x is positional parameter-type charcode, y is result-type charcode
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45
34
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
46 SIG | FROM PYTHON 2 | FROM PYTHON 3 | C/C++ | TO PYTHON 2 | TO PYTHON 3
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
47 ----+---------------------------------+---------------------------------+---------------------------------+--------------------------------------+---------------------------------------
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
48 'v' | | | void | None (Py_None) (e.g. ret of "...)v") | None (Py_None) (e.g. ret of "...)v")
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
49 'B' | bool (PyBool) | bool (PyBool) # | int/bool | bool (PyBool) | bool (PyBool) @
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
50 'c' | int (PyInt) % | int (PyLong) % | char | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
51 | str (with only a single char) % | str (with only a single char) % | char | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
52 'C' | int (PyInt) % | int (PyLong) % | unsigned char | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
53 | str (with only a single char) % | str (with only a single char) % | unsigned char | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
54 's' | int (PyInt) % | int (PyLong) % | short | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
55 'S' | int (PyInt) % | int (PyLong) % | unsigned short | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
56 'i' | int (PyInt) | int (PyLong) | int | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
57 'I' | int (PyInt) | int (PyLong) | unsigned int | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
58 'j' | int (PyInt) | int (PyLong) | long | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
59 'J' | int (PyInt) | int (PyLong) | unsigned long | int (PyInt) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
60 'l' | int (PyInt) | int (PyLongLong) | long long | long (PyLong) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
61 | long (PyLong) | - | long long | long (PyLong) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
62 'L' | int (PyInt) | int (PyLongLong) | unsigned long long | long (PyLong) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
63 | long (PyLong) | - | unsigned long long | long (PyLong) | int (PyLong)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
64 'f' | float (PyFloat) $ | float (PyFloat) $ | float | float (PyFloat) ^ | float (PyFloat) ^
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
65 'd' | float (PyFloat) | float (PyFloat) | double | float (PyFloat) | float (PyFloat)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
66 'p' | bytearray (PyByteArray) & | bytearray (PyByteArray) & | void* | int,long (Py_ssize_t) | int (Py_ssize_t)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
67 | int (PyInt) | int (PyLong) | void* | int,long (Py_ssize_t) | int (Py_ssize_t)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
68 | long (PyLong) | - | void* | int,long (Py_ssize_t) | int (Py_ssize_t)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
69 'Z' | str (PyString) ! | str (PyUnicode) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
70 | unicode (PyUnicode) ! | - | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
71 | - | bytes (PyBytes) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
72 | bytearray (PyByteArray) ! | bytearray (PyByteArray) ! | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode)
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73
29
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents: 28
diff changeset
74 # converted to 1 if True and 0 otherwise
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents: 28
diff changeset
75 @ converted to False if 0 and True otherwise
34
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
76 % range/length checked
29
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents: 28
diff changeset
77 $ cast to single precision
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents: 28
diff changeset
78 ^ cast to double precision
34
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
79 & mutable buffer when passed to C
2682a627168c - breaking changes:
Tassilo Philipp
parents: 30
diff changeset
80 ! immutable buffer when passed to C, as strings (in any form) are considered objects, not buffers
16
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
81
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
82 TODO
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
83 ====
a40084782546 - added support for more return values to python binding
cslag
parents: 10
diff changeset
84
28
edbbd467f50a python binding:
Tassilo Philipp
parents: 24
diff changeset
85 - signature suffixes used to indicate calling conventions are not supported yet!
edbbd467f50a python binding:
Tassilo Philipp
parents: 24
diff changeset
86 - callback support
5
bf5625bb6f05 - brought python binding up to dc v0.9
cslag
parents: 4
diff changeset
87
30
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
88 BUGS
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
89 ====
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
90
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
91 - when using Python 2, the dyncall call vm object is never dcFree'd, as there
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
92 is no way to call a "freefunc" as introduced with Python 3 module definitions
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
93 (see PEP 3121 for details)
baf087cf5971 - fixed two ref counting problems
Tassilo Philipp
parents: 29
diff changeset
94