cgo: supports c/go callback funcs

This commit is contained in:
Li Jie
2024-11-26 22:34:19 +08:00
parent 5380ffa471
commit 90763de93c
12 changed files with 162 additions and 84 deletions

View File

@@ -2,6 +2,7 @@
source_filename = "main"
%main.Foo = type { i32, i1 }
%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr }
@"github.com/goplus/llgo/internal/runtime.cgoAlwaysFalse" = external global i1, align 1
@main.format = global [10 x i8] zeroinitializer, align 1
@@ -35,6 +36,15 @@ _llgo_0:
ret void
}
define ptr @main._Cgo_ptr(ptr %0) {
_llgo_0:
ret ptr %0
}
declare void @runtime.cgoUse(%"github.com/goplus/llgo/internal/runtime.eface")
declare void @runtime.cgoCheckResult(%"github.com/goplus/llgo/internal/runtime.eface")
define void @main.init() {
_llgo_0:
%0 = load i1, ptr @"main.init$guard", align 1