From: Russ Cox Date: Wed, 11 Sep 2013 13:56:38 +0000 (-0400) Subject: misc/cgo/test: test of issue 4339 X-Git-Tag: go1.2rc2~267 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=71ed6eb25ac970c4641a1cafb74d9d6574fa28be;p=gostls13.git misc/cgo/test: test of issue 4339 This is not quite what that issue reports, because this does not involve a DLL. But I wanted to make sure this much was working. Update #4339 R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/13653043 --- diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go index f86305bf65..e36f93597c 100644 --- a/misc/cgo/test/cgo_test.go +++ b/misc/cgo/test/cgo_test.go @@ -45,5 +45,6 @@ func Test5603(t *testing.T) { test5603(t) } func Test3250(t *testing.T) { test3250(t) } func TestCallbackStack(t *testing.T) { testCallbackStack(t) } func TestFpVar(t *testing.T) { testFpVar(t) } +func Test4339(t *testing.T) { test4339(t) } func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) } diff --git a/misc/cgo/test/issue4339.c b/misc/cgo/test/issue4339.c new file mode 100644 index 0000000000..15d0004078 --- /dev/null +++ b/misc/cgo/test/issue4339.c @@ -0,0 +1,18 @@ +#include +#include "issue4339.h" + +static void +impl(void) +{ + //printf("impl\n"); +} + +Issue4339 exported4339 = {"bar", impl}; + +void +handle4339(Issue4339 *x) +{ + //printf("handle\n"); + x->bar(); + //printf("done\n"); +} diff --git a/misc/cgo/test/issue4339.go b/misc/cgo/test/issue4339.go new file mode 100644 index 0000000000..f734a25da3 --- /dev/null +++ b/misc/cgo/test/issue4339.go @@ -0,0 +1,16 @@ +// Copyright 2013 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. + +package cgotest + +/* +#include "issue4339.h" +*/ +import "C" + +import "testing" + +func test4339(t *testing.T) { + C.handle4339(&C.exported4339) +} diff --git a/misc/cgo/test/issue4339.h b/misc/cgo/test/issue4339.h new file mode 100644 index 0000000000..20f6cebb6b --- /dev/null +++ b/misc/cgo/test/issue4339.h @@ -0,0 +1,9 @@ +typedef struct Issue4339 Issue4339; + +struct Issue4339 { + char *name; + void (*bar)(void); +}; + +extern Issue4339 exported4339; +void handle4339(Issue4339*);