yjs.go

 1package ygo
 2
 3/*
 4#cgo CFLAGS: -I${SRCDIR}/lib/include
 5#cgo LDFLAGS: -L${SRCDIR}/lib/linux-amd64 -lyrs -ldl -lm
 6
 7#include <stdlib.h>
 8#include "libyrs.h"
 9*/
10import "C"
11
12// Version of the yffi library we're binding to
13const YFFIVersion = "v0.27.3"
14
15// Utility function to convert Go string to C string (must be freed by caller)
16func stringToC(s string) *C.char {
17	return C.CString(s)
18}
19
20// Utility function to convert C string to Go string and free it
21func cStringToGoAndFree(cstr *C.char) string {
22	if cstr == nil {
23		return ""
24	}
25	defer C.ystring_destroy(cstr)
26	return C.GoString(cstr)
27}