File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1938,6 +1938,8 @@ const builtinExportProlog = `
1938
1938
1939
1939
#ifndef GO_CGO_GOSTRING_TYPEDEF
1940
1940
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
1941
+ extern size_t _GoStringLen(_GoString_ s);
1942
+ extern const char *_GoStringPtr(_GoString_ s);
1941
1943
#endif
1942
1944
1943
1945
#endif
Original file line number Diff line number Diff line change
1
+ // build
2
+
3
+ //go:build cgo
4
+
5
+ // Copyright 2025 The Go Authors. All rights reserved.
6
+ // Use of this source code is governed by a BSD-style
7
+ // license that can be found in the LICENSE file.
8
+
9
+ package main
10
+
11
+ /*
12
+ #cgo CFLAGS: -Werror -Wimplicit-function-declaration
13
+
14
+ #include <stdio.h>
15
+
16
+ static void CFn(_GoString_ gostr) {
17
+ printf("%.*s\n", _GoStringLen(gostr), _GoStringPtr(gostr));
18
+ }
19
+ */
20
+ import "C"
21
+
22
+ func main () {
23
+ C .CFn ("hello, world" )
24
+ }
25
+
26
+ // The bug only occurs if there is an exported function.
27
+ //export Fn
28
+ func Fn () {
29
+ }
You can’t perform that action at this time.
0 commit comments