[Go] Add %go_import directive.

This commit is contained in:
Ian Lance Taylor 2014-01-21 11:27:09 -08:00
commit f2dc3a9c1f
5 changed files with 84 additions and 19 deletions

View file

@ -4,6 +4,9 @@
* Go configuration module.
* ------------------------------------------------------------ */
/* Code insertion directives */
#define %go_import(...) %insert(go_imports) %{__VA_ARGS__%}
/* Basic types */
%typemap(gotype) bool, const bool & "bool"

View file

@ -192,30 +192,26 @@ static _gostring_ _swig_makegostring(const char *p, size_t l) {
#ifndef SWIGGO_GCCGO
%insert(go_header) %{
import _ "runtime/cgo"
import "unsafe"
type _ unsafe.Pointer
%}
%go_import("unsafe", _ "runtime/cgo")
#else
%go_import("syscall", "unsafe")
%insert(go_header) %{
import "syscall"
import "unsafe"
type _ syscall.Sockaddr
type _ unsafe.Pointer
%}
#endif
%insert(go_header) %{
type _ unsafe.Pointer
%}
/* Function pointers are translated by the code in go.cxx into
_swig_fnptr. Member pointers are translated to _swig_memberptr. */