Mercurial > pub > dyncall > bindings
annotate go/godc/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 | 8a45a05ff64e |
children | 739c40f35a6a |
rev | line source |
---|---|
0 | 1 dyncall go bindings |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
2 Copyright 2014-2016 Tassilo Philipp |
0 | 3 February 23, 2014 |
4 | |
5 | |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
6 BUILD/INSTALLATION |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
7 ------------------ |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
8 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
9 1) make sure dyncall is built and libraries/headers are in include paths or |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
10 CGO_CFLAGS points to them, etc. |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
11 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
12 2) Build this nut with: |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
13 go build |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
14 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
15 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
16 API |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
17 --- |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
18 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
19 Since go is low level, dyncall's public functions are pretty much exposed |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
20 function by function. Referg to dyncall(3) and godc.go. |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
21 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
22 l := new(ExtLib) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
23 err := l.Load(libpath) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
24 defer l.Free() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
25 err := l.SymsInit(libpath) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
26 defer l.SymsCleanup() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
27 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
28 l.lib // Address lib is loaded at |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
29 l.FindSymbol(symbolname) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
30 l.SymsCount() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
31 l.SymsNameFromValue(l.FindSymbol(synbolname)) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
32 l.SymsName(index) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
33 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
34 vm := new(CallVM) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
35 err := vm.InitCallVM() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
36 defer vm.Free() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
37 vm.Mode(DC_CALL_C_DEFAULT) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
38 vm.Reset() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
39 vm.ArgFloat(36) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
40 rf := vm.CallFloat(l.FindSymbol("sqrtf")) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
41 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
42 vm.Arg.... |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
43 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
44 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
45 SIGNATURE FORMAT |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
46 ---------------- |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
47 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
48 Signature string is only used by ArgF function, rest uses type info from Go. |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
49 |
0 | 50 TYPE CONVERSIONS (and reserved signature char) |
51 | |
52 SIG | FROM GO | C/C++ | TO GO | |
53 ----+---------------------+--------------------+---------------- | |
54 'v' | | void | | |
55 'B' | bool | bool | bool | |
56 'c' | int8,C.schar | char | int8 | |
57 'C' | uint8,byte,C.uchar | unsigned char | uint8,byte | |
58 's' | int16,C.sshort | short | int16 | |
59 'S' | uint16,C.ushort | unsigned short | uint16 | |
60 'i' | int32,C.sint | int | int32 | |
61 'I' | uint32,C.uint | unsigned int | uint32 | |
62 'j' | int32,rune,C.slong | long | int32,rune | |
63 'J' | uint32,C.ulong | unsigned long | uint32 | |
64 'l' | int64,C.slonglong | long long | int64 | |
65 'L' | uint64,C.ulonglong | unsigned long long | uint64 | |
66 'f' | float32,C.float | float | float32 | |
67 'd' | float64,C.double | double | float64 | |
68 'p' | *,[],unsafe.Pointer | void* | unsafe.Pointer | |
69 'Z' | string | void* | string | |
70 | |
71 | |
72 ToDo: | |
73 - structs | |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
74 - callbacks |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
75 - callf wrap (argf already there) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
76 |