comparison python/pydc/README.txt @ 16:a40084782546

- added support for more return values to python binding - python binding readme update
author cslag
date Sat, 26 Mar 2016 22:31:42 +0100
parents 6493c9ed4b33
children 681db37a300c
comparison
equal deleted inserted replaced
15:1673ab696715 16:a40084782546
1 dyncall python bindings 1 dyncall python bindings
2 (C) 2007-2016 Daniel Adler. 2 (C) 2007-2016 Daniel Adler
3 Dec 4, 2007: initial 3 Dec 4, 2007: initial
4 Mar 22,2016: brought up to dyncall 0.9 4 Mar 22,2016: update to dyncall 0.9, includes breaking sig char changes
5 5
6 6
7 BUILD/INSTALLATION 7 BUILD/INSTALLATION
8 ------------------ 8 ==================
9 9
10 1) make sure dyncall is built and libraries/headers are in include paths or 10 1) make sure dyncall is built and libraries/headers are in include paths or
11 CFLAGS points to them, etc. 11 CFLAGS points to them, etc.
12 12
13 2) Build and install this extension with: 13 2) Build and install this extension with:
14 python setup.py install 14
15 python setup.py install
16
17 Building an egg isn't supported, currently.
15 18
16 19
17 API 20 API
18 --- 21 ===
19 22
20 libhandle = load(libpath) 23 libhandle = load(libpath)
21 funcptr = find(libhandle, symbolname) 24 funcptr = find(libhandle, symbolname)
22 call(funcptr, signature, ...) 25 call(funcptr, signature, ...)
23 26
24 27
25 SIGNATURE FORMAT 28 SIGNATURE FORMAT
26 ---------------- 29 ================
27 30
28 is a formated string 31 is a formated string
29 32
30 format: "xxxxx)y" 33 format: "xxxxx)y"
31 34
32 x is positional parameter-type charcode 35 x is positional parameter-type charcode, y is result-type charcode
33 36
34 'B' C++: bool <- Python: PyBool 37 SIG | FROM PYTHON | C/C++ | TO PYTHON
35 'c' C: char <- Python: PyInt (range checked) 38 ----+------------------------------------+--------------------+-----------------------------------
36 's' C: short <- Python: PyInt (range checked) 39 'v' | | void |
37 'i' C: int <- Python: PyInt 40 'B' | PyBool | bool | PyBool
38 'j' C: long <- Python: PyLong 41 'c' | PyInt (range checked) | char | PyInt
39 'l' C: long long <- Python: PyLongLong 42 'C' | PyInt (range checked) | unsigned char | PyInt
40 'f' C: float <- Python: PyFloat (cast to single precision) 43 's' | PyInt (range checked) | short | PyInt
41 'd' C: double <- Python: PyFloat 44 'S' | PyInt (range checked) | unsigned short | PyInt
42 'p' C: void* <- Python: PyCObject 45 'i' | PyInt | int | PyInt
43 'Z' C: const char* <- Python: PyString 46 'I' | PyInt | unsigned int | PyInt
47 'j' | PyLong | long | PyLong
48 'J' | PyLong | unsigned long | PyLong
49 'l' | PyLongLong | long long | PyLongLong
50 'L' | PyLongLong | unsigned long long | PyLongLong
51 'f' | PyFloat (cast to single precision) | float | PyFloat (cast to double precision)
52 'd' | PyFloat | double | PyFloat
53 'p' | PyCObject | void* | PyCObject encapsulating a void*
54 'Z' | PyString | const char* | PyString
44 55
45 y is result-type charcode
46 56
47 'v' C: void 57 TODO
48 'B' C++: bool -> Python: PyBool 58 ====
49 'c' C: char -> Python: PyInt 59
50 's' C: short -> Python: PyInt 60 - support signature suffixes used to indicate calling conventions, are not supported yet!
51 'i' C: int -> Python: PyInt 61 - not sure if returning 'p' is working, creating PyCObject, check and write test code
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
58 62
59 63
60 BUGS 64 BUGS
61 ---- 65 ====
62 66
63 * build on osx/ppc - link error i386 something... [MacPython 2.4] 67 * build on osx/ppc - link error i386 something... [MacPython 2.4]
64 68
65 solution: 69 solution:
66 installation of latest python for os x (MacPython 2.5) 70 installation of latest python for os x (MacPython 2.5)