Commit 71ed6eb2 authored by Russ Cox's avatar Russ Cox

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
parent 3ee0744c
...@@ -45,5 +45,6 @@ func Test5603(t *testing.T) { test5603(t) } ...@@ -45,5 +45,6 @@ func Test5603(t *testing.T) { test5603(t) }
func Test3250(t *testing.T) { test3250(t) } func Test3250(t *testing.T) { test3250(t) }
func TestCallbackStack(t *testing.T) { testCallbackStack(t) } func TestCallbackStack(t *testing.T) { testCallbackStack(t) }
func TestFpVar(t *testing.T) { testFpVar(t) } func TestFpVar(t *testing.T) { testFpVar(t) }
func Test4339(t *testing.T) { test4339(t) }
func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) } func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
#include <stdio.h>
#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");
}
// 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)
}
typedef struct Issue4339 Issue4339;
struct Issue4339 {
char *name;
void (*bar)(void);
};
extern Issue4339 exported4339;
void handle4339(Issue4339*);
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