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
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 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
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 February 23, 2014
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5
9
8a45a05ff64e - go binding cleanup, not enforcing relative paths anymore, readme update
cslag
parents: 0
diff changeset
6 BUILD/INSTALLATION
17
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
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
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
10
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
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
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
14
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
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
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
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
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
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
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 TYPE CONVERSIONS (and reserved signature char)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 SIG | FROM GO | C/C++ | TO GO
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 ----+---------------------+--------------------+----------------
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 'v' | | void |
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 'B' | bool | bool | bool
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 'c' | int8,C.schar | char | int8
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 'C' | uint8,byte,C.uchar | unsigned char | uint8,byte
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 's' | int16,C.sshort | short | int16
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 'S' | uint16,C.ushort | unsigned short | uint16
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 'i' | int32,C.sint | int | int32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 'I' | uint32,C.uint | unsigned int | uint32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 'j' | int32,rune,C.slong | long | int32,rune
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 'J' | uint32,C.ulong | unsigned long | uint32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 'l' | int64,C.slonglong | long long | int64
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 'L' | uint64,C.ulonglong | unsigned long long | uint64
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 'f' | float32,C.float | float | float32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 'd' | float64,C.double | double | float64
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 'p' | *,[],unsafe.Pointer | void* | unsafe.Pointer
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 'Z' | string | void* | string
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73
17
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
74 TODO
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
75 ====
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
76
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
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
739c40f35a6a - update READMEs
cslag
parents: 9
diff changeset
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