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 5package 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// TODO(#56378): #cgo nocallback runCShouldNotCallback 12extern void runCShouldNotCallback(); 13*/ 14import "C" 15 16import ( 17 "fmt" 18) 19 20func init() { 21 register("CgoNoCallback", CgoNoCallback) 22} 23 24//export CallbackToGo 25func CallbackToGo() { 26} 27 28func CgoNoCallback() { 29 C.runCShouldNotCallback() 30 fmt.Println("OK") 31} 32