loro/crates/loro-ffi/examples/main.go

21 lines
388 B
Go
Raw Normal View History

2023-01-28 11:59:37 +00:00
package main;
/*
#cgo LDFLAGS: -L./lib -framework Security -lloro
#include "./lib/loro_ffi.h"
*/
import "C"
import "fmt"
func main() {
loro := C.loro_new();
text := C.loro_get_text(loro, C.CString("text"));
pos := C.uint(0);
C.text_insert(text, loro, &pos, C.CString("abc"));
value := C.text_value(text);
fmt.Println(C.GoString(value));
C.text_free(text);
C.loro_free(loro);
}