"os"
"os/exec"
"path/filepath"
- "runtime"
"slices"
"strings"
"sync/atomic"
{
// Exported functions may not return Go pointers.
name: "export1",
- c: `extern unsigned char *GoFn21();`,
+ c: `#ifdef _WIN32
+ __declspec(dllexport)
+ #endif
+ extern unsigned char *GoFn21();`,
support: `//export GoFn21
func GoFn21() *byte { return new(byte) }`,
body: `C.GoFn21()`,
// Returning a C pointer is fine.
name: "exportok",
c: `#include <stdlib.h>
+ #ifdef _WIN32
+ __declspec(dllexport)
+ #endif
extern unsigned char *GoFn22();`,
support: `//export GoFn22
func GoFn22() *byte { return (*byte)(C.malloc(1)) }`,
func TestPointerChecks(t *testing.T) {
testenv.MustHaveGoBuild(t)
testenv.MustHaveCGO(t)
- if runtime.GOOS == "windows" {
- // TODO: Skip just the cases that fail?
- t.Skipf("some tests fail to build on %s", runtime.GOOS)
- }
var gopath string
var dir string