mirror of
https://github.com/golang/go
synced 2024-11-25 01:37:57 -07:00
8c72b81132
Depends on CL 8715043 and CL 8676050. Fixes #5273. R=alex.brainman, r CC=gobot, golang-dev https://golang.org/cl/8764043
26 lines
635 B
C
26 lines
635 B
C
// 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
|
|
// A Windows DLL is unable to call an arbitrary function in
|
|
// the main executable. Work around that by making the main
|
|
// executable pass the callback function pointer to us.
|
|
void (*goCallback)(void);
|
|
__declspec(dllexport) void setCallback(void *f)
|
|
{
|
|
goCallback = (void (*)())f;
|
|
}
|
|
__declspec(dllexport) void sofunc(void);
|
|
#else
|
|
extern void goCallback(void);
|
|
void setCallback(void *f) { (void)f; }
|
|
#endif
|
|
|
|
void sofunc(void)
|
|
{
|
|
goCallback();
|
|
}
|