Commit f8bcebe4 authored by Alex Brainman's avatar Alex Brainman

Revert "misc/cgo/testso: add test for fixed issue 4339"

This reverts commit 9fa9f966.

The change has broken darwin and netbsd builders. It needs to be tested properly.

Change-Id: Id9e2d30caa8764c362c9f33890015dfc1aae0dab
Reviewed-on: https://go-review.googlesource.com/8527
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
parent 827a8a56
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "cgoso_c.h"
#include "_cgo_export.h" #include "_cgo_export.h"
#ifdef WIN32 #ifdef WIN32
...@@ -13,7 +12,3 @@ void init() { ...@@ -13,7 +12,3 @@ void init() {
#else #else
void init() {} void init() {}
#endif #endif
const char* getVar() {
return exported_var;
}
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package cgosotest package cgosotest
/* /*
#cgo windows CFLAGS: -DIMPORT_DLL
// intentionally write the same LDFLAGS differently // intentionally write the same LDFLAGS differently
// to test correct handling of LDFLAGS. // to test correct handling of LDFLAGS.
#cgo linux LDFLAGS: -L. -lcgosotest #cgo linux LDFLAGS: -L. -lcgosotest
...@@ -16,32 +15,14 @@ package cgosotest ...@@ -16,32 +15,14 @@ package cgosotest
#cgo darwin LDFLAGS: -L. libcgosotest.dylib #cgo darwin LDFLAGS: -L. libcgosotest.dylib
#cgo windows LDFLAGS: -L. libcgosotest.dll #cgo windows LDFLAGS: -L. libcgosotest.dll
#include "cgoso_c.h"
void init(void); void init(void);
void sofunc(void); void sofunc(void);
const char* getVar(void);
*/ */
import "C" import "C"
import "fmt"
func Test() { func Test() {
C.init() C.init()
C.sofunc() C.sofunc()
testExportedVar()
}
func testExportedVar() {
const want = "Hello world"
got := C.GoString(C.getVar())
if got != want {
panic(fmt.Sprintf("testExportedVar: got %q, but want %q", got, want))
}
got = C.GoString(C.exported_var)
if got != want {
panic(fmt.Sprintf("testExportedVar: got %q, but want %q", got, want))
}
} }
//export goCallback //export goCallback
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
// +build ignore // +build ignore
#include "cgoso_c.h"
#ifdef WIN32 #ifdef WIN32
// A Windows DLL is unable to call an arbitrary function in // A Windows DLL is unable to call an arbitrary function in
// the main executable. Work around that by making the main // the main executable. Work around that by making the main
...@@ -30,5 +28,3 @@ void sofunc(void) ...@@ -30,5 +28,3 @@ void sofunc(void)
{ {
goCallback(); goCallback();
} }
const char *exported_var = "Hello world";
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
#ifdef WIN32
#if defined(EXPORT_DLL)
# define VAR __declspec(dllexport)
#elif defined(IMPORT_DLL)
# define VAR __declspec(dllimport)
#endif
#else
# define VAR
#endif
VAR const char *exported_var;
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
@echo off @echo off
gcc -c cgoso_c.c -DEXPORT_DLL gcc -c cgoso_c.c
gcc -shared -o libcgosotest.dll cgoso_c.o gcc -shared -o libcgosotest.dll cgoso_c.o
if not exist libcgosotest.dll goto fail if not exist libcgosotest.dll goto fail
go build main.go go build main.go
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment