| 1 |
// Copyright 2025 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 |
//go:build darwin |
| 6 |
|
| 7 |
package cgotest |
| 8 |
|
| 9 |
/* |
| 10 |
#cgo LDFLAGS: -Wl,-undefined,dynamic_lookup |
| 11 |
|
| 12 |
extern void __gotest_cgo_null_api(void) __attribute__((weak_import)); |
| 13 |
|
| 14 |
int issue76023(void) { |
| 15 |
if (__gotest_cgo_null_api) return 1; |
| 16 |
return 0; |
| 17 |
} |
| 18 |
*/ |
| 19 |
import "C" |
| 20 |
import "testing" |
| 21 |
|
| 22 |
func issue76023(t *testing.T) { |
| 23 |
r := C.issue76023() |
| 24 |
if r != 0 { |
| 25 |
t.Error("found __gotest_cgo_null_api") |
| 26 |
} |
| 27 |
} |