package main

import (
	"fmt"

	"unsafe"

	"github.com/tidbcloud/drhouse/planedecode/plancodec"
)

/*
#include <stdlib.h>
*/
import "C"

//export DecodePlan
func DecodePlan(plan *C.char) *C.char {
	goplan := C.GoString(plan)
	res, err := plancodec.DecodePlan(goplan)
	if err != nil {
		fmt.Println(err)
		return C.CString("")
	}
	return C.CString(res)
}

//export Freestr
func Freestr(addr *C.char) {
	C.free(unsafe.Pointer(addr))
}

func main() {
}
