Commit graph

28 commits

Author SHA1 Message Date
Olly Betts
2da3815f99 [Go] Make -intgosize optional
We no longer support Go < 1.2 so we can default intgo to ptrdiff_t
and uintgo to size_t.

Fixes #683
Fixes #2233
2022-03-16 18:30:05 +13:00
Ian Lance Taylor
70d530adfc swig -go: treat a nil argument as NULL
Let Go code pass "nil" when calling a C++ function that accepts a
pointer to a class.  The Go "nil" will be treated as a C++ "nullptr".

Fixes #2203
2022-03-08 15:15:05 -08:00
Ian Lance Taylor
6ca5d5d722 swig -go: don't use crosscall2 for panicking
Instead rely only on documented and exported interfaces.
2021-09-15 17:56:01 -07:00
Ian Lance Taylor
4461c443cf remove Go -no-cgo option
It only worked for Go versions before 1.5, which is more than five
years ago and long-unsupported.
2021-09-14 13:59:21 -07:00
William S Fulton
bea708c796 Go - use director.swg like other languages
Changes the location of the director code wrt to the generated _wrap.h
file to fix throw macro skullduggery in the director_throws testcase
(see previous commit).
2018-05-06 09:46:37 +01:00
Ian Lance Taylor
223c2a4835 [Go] Fixes for Go 1.6: avoid returning Go pointers from
directors that return string values; add a trailing 0 byte
when treating Go string as C char*.
2016-04-17 17:52:09 -07:00
Ian Lance Taylor
15b75a74c5 [Go] Ensure structs are properly packed between gc and GCC/clang.
From https://github.com/swig/swig/pull/262.
2016-01-27 15:51:13 -08:00
Ian Lance Taylor
48263f4802 [Go] Make sure that arguments for which use memcpy when calling C are
still live after the call.  This ensures that they will not be
collected if the GC runs during the call.
2015-05-04 15:11:31 -07:00
Ian Lance Taylor
661c4ba036 [Go] Add comments telling users that _swig_goallocate and
_swig_makegostring will no longer work in the Go 1.5 release.
Keep the existing code so that existing users with current versions of
Go will not break suddenly.
2015-04-17 09:44:40 -07:00
Ian Lance Taylor
9ad497c08e [Go] Add -cgo option, required for Go version 1.5 and later. 2015-03-02 14:03:33 -08:00
Ian Lance Taylor
1dd401899f [Go] Change SWIG directors to use a handle instead of a Go pointer.
In future releases of Go it will not be possible to pass Go pointers
into C/C++ code.  The handle is automatically translated back to the
Go value using a Go map.  Since directors must be explicitly deleted,
we can reliably use that call to remove the handle from the map.
2015-02-22 11:09:58 -08:00
Ian Lance Taylor
2562c1eb41 [Go] Remove all calls to _swig_goallocate in the Go runtime, except
for the one from _swig_makegostring.  _swig_goallocate can not work
with the future Go 1.5 release.  When using Go 1.5 attempts to call
_swig_goallocate will fail at link time.
2015-02-04 16:08:44 -08:00
Ian Lance Taylor
0577ff2220 [Go] Adjust last patch to avoid write-after-write data race on global
variable.  Only set the variable if another global variable is true,
but that variable is always false.  The effect is that the variable is
never written, but as far as the compiler is concerned it might escape.
2014-10-14 10:05:43 -07:00
Ian Lance Taylor
4b64ce71a3 [Go] Adjust generated code to work with upcoming Go 1.4 release. 2014-09-25 12:10:11 -07:00
Karl Wette
66555ad2a7 Fix go configuration and SWIG_GCC_VERSION
- in configure.ac: modify sed expression to only look at first line of
  gccgo --version, extract the last numeric token, and remove periods;
  this parses e.g. "gccgo (Debian 4.7.2-5) 4.7.2"
- in goruntime.swg: fix typo in __GNUC_PATCHLEVEL__ (SF Bug #1298)
2014-05-02 21:44:52 +02:00
Ian Lance Taylor
f2dc3a9c1f [Go] Add %go_import directive. 2014-01-21 11:27:09 -08:00
Ian Lance Taylor
532da6989c [Go] Add -go-pkgpath option. 2013-12-17 13:50:39 -08:00
Ian Lance Taylor
ab7da898ef Define uintgo for the benefit of Go .swig files.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13876 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-10-31 03:41:10 +00:00
Ian Lance Taylor
a42882dcee Adjust for change in the size of the Go type int. Until some time in
the future, require a -intgosize option when invoking SWIG.  Otherwise
there is no reliable way for us to know the size of int, and we need
to know.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13864 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-10-05 04:58:00 +00:00
Ian Lance Taylor
5a19113432 Import unsafe in generated Go code, so that pointers stored as type
uintptr do not get garbage collected.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13153 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-06-05 20:54:08 +00:00
Ian Lance Taylor
9a6dc5ac40 Fix typo in name of SwigDoCgocallDone for GCC < 4.7.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13151 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-06-05 13:32:28 +00:00
Ian Lance Taylor
7ec208da05 Fix Go support to use appropriate interface for entering and leaving
C/C++ code, depending on GCC version.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13146 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-06-04 05:37:10 +00:00
Ian Lance Taylor
602730a327 Add support for new features available in gccgo 4.7, notably calling
Entersyscall and Exitsyscall around calls to wrapped C/C++ code.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12940 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-03-20 22:35:40 +00:00
Ian Lance Taylor
18a4f389f9 Update to support current Go releases.
The Go foreign function interface changed.  This changes SWIG
accordingly, and also fixes a couple of bugs.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12389 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-11 18:46:50 +00:00
Ian Lance Taylor
580f254958 Update for recent runtime name changes (a better mechanism is clearly
needed here).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12290 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-11-12 16:43:03 +00:00
Ian Lance Taylor
9d466dd408 Rename size checking macros to avoid leading double underscore. Also
change goswig to swiggo.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12127 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-15 17:59:32 +00:00
William S Fulton
7e7bd74ff2 Remove Go director hack just to please the SWIG test-suite
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12120 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-11 19:05:30 +00:00
Ian Lance Taylor
5af2978f77 Add support for the Go programming language.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12108 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-06-10 01:13:31 +00:00