Mercurial > pub > dyncall > bindings
annotate go/godc/README.txt @ 60:8e905c0798c7
- p2Z() helper func
- import fix for test code avoiding potential circular import
author | Tassilo Philipp |
---|---|
date | Wed, 03 Aug 2022 15:38:07 +0200 |
parents | 1e3d929e43be |
children |
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 |
17 | 7 ================== |
9
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 |
17 | 10 |
11 CGO_CFLAGS points to them, etc. | |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
12 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
13 2) Build this nut with: |
17 | 14 |
15 go build | |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
16 |
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 API |
17 | 19 === |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
20 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
21 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
|
22 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
|
23 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
24 l := new(ExtLib) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
25 err := l.Load(libpath) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
26 defer l.Free() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
27 err := l.SymsInit(libpath) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
28 defer l.SymsCleanup() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
29 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
30 l.lib // Address lib is loaded at |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
31 l.FindSymbol(symbolname) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
32 l.SymsCount() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
33 l.SymsNameFromValue(l.FindSymbol(synbolname)) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
34 l.SymsName(index) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
35 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
36 vm := new(CallVM) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
37 err := vm.InitCallVM() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
38 defer vm.Free() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
39 vm.Mode(DC_CALL_C_DEFAULT) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
40 vm.Reset() |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
41 vm.ArgFloat(36) |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
42 rf := vm.CallFloat(l.FindSymbol("sqrtf")) |
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 vm.Arg.... |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
45 |
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 SIGNATURE FORMAT |
17 | 48 ================ |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
49 |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
50 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
|
51 |
0 | 52 TYPE CONVERSIONS (and reserved signature char) |
53 | |
54 SIG | FROM GO | C/C++ | TO GO | |
55 ----+---------------------+--------------------+---------------- | |
56 'v' | | void | | |
57 'B' | bool | bool | bool | |
58 'c' | int8,C.schar | char | int8 | |
59 'C' | uint8,byte,C.uchar | unsigned char | uint8,byte | |
60 's' | int16,C.sshort | short | int16 | |
61 'S' | uint16,C.ushort | unsigned short | uint16 | |
62 'i' | int32,C.sint | int | int32 | |
63 'I' | uint32,C.uint | unsigned int | uint32 | |
64 'j' | int32,rune,C.slong | long | int32,rune | |
65 'J' | uint32,C.ulong | unsigned long | uint32 | |
66 'l' | int64,C.slonglong | long long | int64 | |
67 'L' | uint64,C.ulonglong | unsigned long long | uint64 | |
68 'f' | float32,C.float | float | float32 | |
69 'd' | float64,C.double | double | float64 | |
70 'p' | *,[],unsafe.Pointer | void* | unsafe.Pointer | |
71 'Z' | string | void* | string | |
72 | |
73 | |
17 | 74 TODO |
75 ==== | |
76 | |
0 | 77 - structs |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
78 - callbacks |
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
79 - callf wrap (argf already there) |
42
1e3d929e43be
- godc updated to dc 1.1 and added note about missing feature
Tassilo Philipp
parents:
17
diff
changeset
|
80 - signature chars used to indicate calling conventions are not supported yet! |
17 | 81 - update cconv modes, so they are up to date |
9
8a45a05ff64e
- go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents:
0
diff
changeset
|
82 |