$ go build -buildmode=c-shared -o hello.dll hello.go
生成对应的头文件
/* Code generated by cmd/cgo; DO NOT EDIT. *//* package command-line-arguments */#line 1 "cgo-builtin-export-prolog"#include<stddef.h>/* for ptrdiff_t below */#ifndef GO_CGO_EXPORT_PROLOGUE_H#define GO_CGO_EXPORT_PROLOGUE_H#ifndef GO_CGO_GOSTRING_TYPEDEFtypedefstruct{constchar*p; ptrdiff_t n;} _GoString_;#endif#endif/* Start of preamble from import "C" comments. *//* End of preamble from import "C" comments. *//* Start of boilerplate cgo prologue. */#line 1 "cgo-gcc-export-header-prolog"#ifndef GO_CGO_PROLOGUE_H#define GO_CGO_PROLOGUE_Htypedefsignedchar GoInt8;typedefunsignedchar GoUint8;typedefshort GoInt16;typedefunsignedshort GoUint16;typedefint GoInt32;typedefunsignedint GoUint32;typedeflonglong GoInt64;typedefunsignedlonglong GoUint64;typedef GoInt64 GoInt;typedef GoUint64 GoUint;typedef __SIZE_TYPE__ GoUintptr;typedeffloat GoFloat32;typedefdouble GoFloat64;typedeffloat _Complex GoComplex64;typedefdouble _Complex GoComplex128;/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/typedefchar _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8?1:-1];#ifndef GO_CGO_GOSTRING_TYPEDEFtypedef _GoString_ GoString;#endiftypedefvoid*GoMap;typedefvoid*GoChan;typedefstruct{void*t;void*v;} GoInterface;typedefstruct{void*data; GoInt len; GoInt cap;} GoSlice;#endif/* End of boilerplate cgo prologue. */#ifdef __cplusplusextern"C"{#endifexternchar*hello(GoString p0);#ifdef __cplusplus}#endif