]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: maybe fix Windows build broken by cgo setenv CL
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 2 May 2011 20:35:28 +0000 (13:35 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 2 May 2011 20:35:28 +0000 (13:35 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/4428078

src/pkg/runtime/cgo/Makefile
src/pkg/runtime/cgo/setenv.c [new file with mode: 0644]
src/pkg/runtime/cgo/util.c

index 768fe80ace23731cabf6ec381fe839744ba014fb..f26da2c518e6dfec4638c06d4ca84c7a7f25a01c 100644 (file)
@@ -28,18 +28,20 @@ CGO_OFILES=\
        $(GOOS)_$(GOARCH).o\
        util.o\
 
-OFILES=\
-       iscgo.$O\
-       callbacks.$O\
-       _cgo_import.$O\
-       $(CGO_OFILES)\
-
 ifeq ($(GOOS),windows)
 CGO_LDFLAGS=-lm -mthreads
 else
 CGO_LDFLAGS=-lpthread
+CGO_OFILES+=setenv.o\
+
 endif
 
+OFILES=\
+       iscgo.$O\
+       callbacks.$O\
+       _cgo_import.$O\
+       $(CGO_OFILES)\
+
 ifeq ($(GOOS),freebsd)
 OFILES+=\
        freebsd.$O\
diff --git a/src/pkg/runtime/cgo/setenv.c b/src/pkg/runtime/cgo/setenv.c
new file mode 100644 (file)
index 0000000..c911b83
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 20111 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.
+
+#include "libcgo.h"
+
+#include <stdlib.h>
+
+/* Stub for calling setenv */
+static void
+xlibcgo_setenv(char **arg)
+{
+       setenv(arg[0], arg[1], 1);
+}
+
+void (*libcgo_setenv)(char**) = xlibcgo_setenv;
index ba6e0ca9c38824fa988f062857bb10be617e7ee8..0eff19aa6d5e99023a7013cc662d8065dc1870f2 100644 (file)
@@ -4,8 +4,6 @@
 
 #include "libcgo.h"
 
-#include <stdlib.h>
-
 /* Stub for calling malloc from Go */
 static void
 x_cgo_malloc(void *p)
@@ -51,12 +49,3 @@ xlibcgo_thread_start(ThreadStart *arg)
 }
 
 void (*libcgo_thread_start)(ThreadStart*) = xlibcgo_thread_start;
-
-/* Stub for calling setenv */
-static void
-xlibcgo_setenv(char **arg)
-{
-       setenv(arg[0], arg[1], 1);
-}
-
-void (*libcgo_setenv)(char**) = xlibcgo_setenv;