changeset 9:8a45a05ff64e

- go binding cleanup, not enforcing relative paths anymore, readme update
author cslag
date Sat, 26 Mar 2016 01:09:51 +0100
parents c7830d9614f5
children 6493c9ed4b33
files go/godc/README.txt go/godc/godc.go
diffstat 2 files changed, 54 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/go/godc/README.txt	Sat Mar 26 00:13:32 2016 +0100
+++ b/go/godc/README.txt	Sat Mar 26 01:09:51 2016 +0100
@@ -1,8 +1,52 @@
 dyncall go bindings
-Copyright 2014 Tassilo Philipp
+Copyright 2014-2016 Tassilo Philipp
 February 23, 2014
 
 
+BUILD/INSTALLATION
+------------------
+
+1) make sure dyncall is built and libraries/headers are in include paths or
+   CGO_CFLAGS points to them, etc.
+
+2) Build this nut with:
+   go build
+
+
+API
+---
+
+Since go is low level, dyncall's public functions are pretty much exposed
+function by function. Referg to dyncall(3) and godc.go.
+
+l := new(ExtLib)
+err := l.Load(libpath)
+defer l.Free()
+err := l.SymsInit(libpath)
+defer l.SymsCleanup()
+
+l.lib // Address lib is loaded at
+l.FindSymbol(symbolname)
+l.SymsCount()
+l.SymsNameFromValue(l.FindSymbol(synbolname))
+l.SymsName(index)
+
+vm := new(CallVM)
+err := vm.InitCallVM()
+defer vm.Free()
+vm.Mode(DC_CALL_C_DEFAULT)
+vm.Reset()
+vm.ArgFloat(36)
+rf := vm.CallFloat(l.FindSymbol("sqrtf"))
+
+vm.Arg....
+
+
+SIGNATURE FORMAT
+----------------
+
+Signature string is only used by ArgF function, rest uses type info from Go.
+
 TYPE CONVERSIONS (and reserved signature char)
 
   SIG | FROM GO             | C/C++              | TO GO
@@ -27,4 +71,6 @@
 
 ToDo:
 - structs
-- callf wrap
+- callbacks
+- callf wrap (argf already there)
+
--- a/go/godc/godc.go	Sat Mar 26 00:13:32 2016 +0100
+++ b/go/godc/godc.go	Sat Mar 26 01:09:51 2016 +0100
@@ -21,13 +21,13 @@
 // Go/dyncall extension implementation.
 package godc
 
-// #cgo LDFLAGS: -L../../../dyncall/ -ldyncall_s
-// #cgo LDFLAGS: -L../../../dynload/ -ldynload_s
-// #cgo LDFLAGS: -L../../../dyncallback/ -ldyncallback_s
+// #cgo LDFLAGS: -ldyncall_s
+// #cgo LDFLAGS: -ldynload_s
+// #cgo LDFLAGS: -ldyncallback_s
 // #include <stdlib.h>
-// #include "../../../dyncall/dyncall/dyncall.h"
-// #include "../../../dyncall/dynload/dynload.h"
-// #include "../../../dyncall/dyncall/dyncall_signature.h"
+// #include "dyncall.h"
+// #include "dynload.h"
+// #include "dyncall_signature.h"
 import "C"
 import (
 	"unsafe"