Mercurial > pub > dyncall > bindings
annotate python/pydc/README.txt @ 32:2089026debae
- allowing 'None' as arg for pydc.load, effectively resulting in dlLoadLibrary(NULL), which is own process
author | Tassilo Philipp |
---|---|
date | Sat, 11 Apr 2020 18:02:33 +0200 |
parents | baf087cf5971 |
children | 2682a627168c |
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, ...) | |
29 | 31 free(libhandle) |
0 | 32 |
7 | 33 |
0 | 34 SIGNATURE FORMAT |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
35 ================ |
0 | 36 |
37 is a formated string | |
38 | |
39 format: "xxxxx)y" | |
40 | |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
41 x is positional parameter-type charcode, y is result-type charcode |
0 | 42 |
29 | 43 SIG | FROM PYTHON 2 | FROM PYTHON 3 | C/C++ | TO PYTHON 2 | TO PYTHON 3 |
44 ----+------------------------------------------------------+------------------------------------------+---------------------------------+--------------------------------------+------------------------------------- | |
45 'v' | | | void | None (Py_None) (e.g. ret of "...)v") | None (Py_None) (e.g. ret of "...)v") | |
46 'B' | bool (PyBool) | bool (PyBool)# | int/bool | bool (PyBool) | bool (PyBool)@ | |
47 'c' | int (PyLong)%, str (single char)% | int (PyLong)%, str (single char)% | char | int (PyInt) | int (PyLong) | |
48 'C' | int (PyLong)%, str (single char)% | int (PyLong)%, str (single char)% | unsigned char | int (PyInt) | int (PyLong) | |
49 's' | int (PyInt)% | int (PyLong)% | short | int (PyInt) | int (PyLong) | |
50 'S' | int (PyInt)% | int (PyLong)% | unsigned short | int (PyInt) | int (PyLong) | |
51 'i' | int (PyInt) | int (PyLong) | int | int (PyInt) | int (PyLong) | |
52 'I' | int (PyInt) | int (PyLong) | unsigned int | int (PyInt) | int (PyLong) | |
53 'j' | int (PyInt) | int (PyLong) | long | int (PyInt) | int (PyLong) | |
54 'J' | int (PyInt) | int (PyLong) | unsigned long | int (PyInt) | int (PyLong) | |
55 'l' | int (PyInt), long (PyLong) | int (PyLongLong) | long long | long (PyLong) | int (PyLong) | |
56 'L' | int (PyInt), long (PyLong) | int (PyLongLong) | unsigned long long | long (PyLong) | int (PyLong) | |
57 'f' | float (PyFloat)$ | float (PyFloat)$ | float | float (PyFloat)^ | float (PyFloat)^ | |
58 'd' | float (PyFloat) | float (PyFloat) | double | float (PyFloat) | float (PyFloat) | |
59 'p' | str (PyUnicode/PyString), int (PyInt), long (PyLong) | str (PyUnicode), int (PyLong), (PyBytes) | void* | int,long (Py_ssize_t) | int (Py_ssize_t) | |
60 'Z' | str (PyUnicode/PyString) | str (PyUnicode), (PyBytes) | const char* (UTF-8 for unicode) | int (PyString) | str (PyUnicode) | |
0 | 61 |
29 | 62 # converted to 1 if True and 0 otherwise |
63 @ converted to False if 0 and True otherwise | |
64 % range checked | |
65 $ cast to single precision | |
66 ^ cast to double precision | |
16
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
67 |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
68 TODO |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
69 ==== |
a40084782546
- added support for more return values to python binding
cslag
parents:
10
diff
changeset
|
70 |
28 | 71 - signature suffixes used to indicate calling conventions are not supported yet! |
72 - callback support | |
5 | 73 |
30 | 74 BUGS |
75 ==== | |
76 | |
77 - when using Python 2, the dyncall call vm object is never dcFree'd, as there | |
78 is no way to call a "freefunc" as introduced with Python 3 module definitions | |
79 (see PEP 3121 for details) | |
80 |