Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cl/_testmockc/type/in.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
int sort(void* a, void* b, int elementSize, int count, int (*cmp)(const void*, const void*));

void f(int (callback)(void));

void g(void);

void h(void (**callbackPtr)(void));
6 changes: 6 additions & 0 deletions cl/_testmockc/type/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ import (
//go:linkname Sort C.sort
func Sort(a unsafe.Pointer, b unsafe.Pointer, elementSize c.Int, count c.Int, cmp func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) c.Int) c.Int

//go:linkname F C.f
func F(callback func() c.Int)

//go:linkname G C.g
func G()

//go:linkname H C.h
func H(callbackPtr *func())
7 changes: 2 additions & 5 deletions cl/type_and_var.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ func newPointer(typ types.Type) types.Type {
if t == tyVoid {
return types.Typ[types.UnsafePointer]
}
case *types.Signature:
panic("todo: newPointer for signature")
/* if gogen.IsCSignature(t) {
return types.NewSignature(nil, t.Params(), t.Results(), t.Variadic())
} */
case *types.Named:
panic("todo: newPointer for named type")
/* if typ == ValistTag {
Expand All @@ -79,6 +74,8 @@ func toType(ctx *blockCtx, pkg *types.Package, typ lc.Type, flags int) types.Typ
return newPointer(pointee)
case lc.TypeVoid:
return tyVoid
case lc.TypeFunctionProto:
return toFuncType(ctx, pkg, typ)
default:
log.Println("==> toType: unknown Kind -", typ.Kind)
}
Expand Down
Loading