cl: c.Func (llgo.funcAddr); demo: cppintf (how to use c++ interface)

This commit is contained in:
xushiwei
2024-06-21 23:44:56 +08:00
parent be0ce57375
commit bfa4e08a4e
11 changed files with 149 additions and 35 deletions

22
_demo/cppintf/foo/foo.go Normal file
View File

@@ -0,0 +1,22 @@
package foo
import (
"unsafe"
)
const (
LLGoFiles = "bar/bar.cpp"
LLGoPackage = "link"
)
type Callback struct {
Vptr *CallbackVtbl
}
type CallbackVtbl struct {
ValA unsafe.Pointer
ValB unsafe.Pointer
}
//go:linkname F C.f
func F(cb *Callback)