Debian Codegraph @

src/runtime/testdata/testprogcgo/cgonocallback.go

raw
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package main
6
7 // #cgo nocallback annotations for a C function means it should not callback to Go.
8 // But it do callback to go in this test, Go should crash here.
9
10 /*
11 #cgo nocallback runCShouldNotCallback
12
13 extern void runCShouldNotCallback();
14 */
15 import "C"
16
17 import (
18 "fmt"
19 )
20
21 func init() {
22 register("CgoNoCallback", CgoNoCallback)
23 }
24
25 //export CallbackToGo
26 func CallbackToGo() {
27 }
28
29 func CgoNoCallback() {
30 C.runCShouldNotCallback()
31 fmt.Println("OK")
32 }