summaryrefslogtreecommitdiff
path: root/Lib/go
Commit message (Collapse)AuthorAgeFilesLines
* Add argc and argv multi-argument to go.Erez Geva2023-04-191-0/+64
| | | | | | Make argc and argv test works in C. Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
* Cleanup SWIG_VERSION definitionWilliam S Fulton2022-10-131-2/+0
| | | | | | | | | | | | | Add Swig_obligatory_macros which must be called by each target language to define SWIG_VERSION correctly in the generated code, as well as the language specific macro SWIGXXX where XXX is the target language name. Drop the #ifdef SWIGXXX that was previously generated - I can't see the point of this and if users are defining this macro somehow, then users will need to change this Closes #1050
* Sort out predefined SWIG-specific macrosOlly Betts2022-10-051-0/+2
| | | | | | | | | | | | | | | | | | | Ensure that SWIG_VERSION is defined both at SWIG-time and in the generated C/C++ wrapper code (it was only defined in the wrapper for some target languages previously). SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers to match behaviour for all other target languages. Stop defining SWIGVERSION in the wrapper. This only happened as a side-effect of how SWIG_VERSION was defined but was never documented and is redundant. The new testcase also checks that SWIG is defined at SWIG-time but not in the generated wrapper, and that exactly one of a list of target-language specific macros is defined. Fixes #1050
* std::string throws typemapsWilliam S Fulton2022-09-191-0/+6
| | | | | | | Go, Guile, Racket, Scilab: Add throws typemaps for std::string so that thrown string exception messages can be seen. Test all language for std::string throws typemaps
* Provide SWIGTYPE MOVE typemaps in swigmove.iWilliam S Fulton2022-09-161-0/+15
| | | | | | | | | | | | For implementing full move semantics when passing parameters by value. Based on SWIGTYPE && and std::unique_ptr typemaps which implement move semantics. Added for all languages, but untested for: Go, Ocaml, R, Scilab (and unlikely to be fully functional for same reasons as for std::unique_ptr support). Issue #999
* SWIGTYPE && input typemaps now assume object has been moved - Go and OCamlWilliam S Fulton2022-08-311-2/+3
| | | | | | | | Not fully implemented and Untested. Go's implementation needs fixing to fully support typemaps before this can be done. OCaml implementation does not have support for releasing ownership which is required to add error checking preventing double deletes.
* [Go] #2245 Handle NULL pointers for string* conversions.Ian Lance Taylor2022-07-051-7/+22
| | | | | | | Rearrange generation of director methods and rename receiver argument from p to swig_p. Fixes #2245
* Performance optimisation for directors for classes passed by valueWilliam S Fulton2022-07-041-1/+1
| | | | | | | The directorin typemaps in the director methods now use std::move on the input parameter when copying the object from the stack to the heap prior to the callback into the target language, thereby taking advantage of move semantics if available.
* [Go] Make -intgosize optionalOlly Betts2022-03-161-0/+1
| | | | | | | | We no longer support Go < 1.2 so we can default intgo to ptrdiff_t and uintgo to size_t. Fixes #683 Fixes #2233
* [Go] add typemaps for std::string*Ian Lance Taylor2022-03-151-0/+50
| | | | Fixes #2214
* swig -go: treat a nil argument as NULLIan Lance Taylor2022-03-081-0/+11
| | | | | | | 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
* swig -go: free correct variable in char *& typemapIan Lance Taylor2022-03-061-1/+1
|
* swig -go: treat non-const references as pointersIan Lance Taylor2022-03-051-5/+43
| | | | | | | Also clean up the handling of int* and int& to convert between the C type int and the Go type int, which are often different sizes. Fixes #2210
* Renames performed by `%namewarn` with `rename=` are printed in warning messageSeth R Johnson2022-02-061-1/+1
| | | | | | This is necessary for regex-like renames (where you can't use the #define trick as is done in many of the %keywordwarn directives). It's now unnecessary to print the "renaming to '`x`'" code explicitly by the kw.swg files.
* Support std::array in Golang (#2045)ERROR2022-01-041-0/+43
| | | | | Support std::array in Golang Closes #2045
* swig -go: don't use crosscall2 for panickingIan Lance Taylor2021-09-151-52/+1
| | | | Instead rely only on documented and exported interfaces.
* remove Go -no-cgo optionIan Lance Taylor2021-09-141-146/+0
| | | | | It only worked for Go versions before 1.5, which is more than five years ago and long-unsupported.
* Consistent parameter names for std::pairWilliam S Fulton2019-02-141-2/+2
|
* Add STL container copy constructors where missingWilliam S Fulton2019-02-143-1/+7
| | | | Also provide consistent copy constructor declarations.
* Add missing typedefs to std::list + typedef correctionsWilliam S Fulton2019-02-141-3/+2
| | | | | | Numerous missing typedefs added. std::list<T*>::const_reference and std::list<T*>::reference specialization typedef fixes.
* Add missing typedefs to std::vector + typedef correctionsWilliam S Fulton2019-02-131-0/+10
| | | | | | | Tests for std::vector of pointers added which check std::vector<T*>::const_reference and std::vector<T*>::reference usage which gave compilation errors in Python and Perl which had specialized these vectors incorrectly.
* Add missing typedefs to std::pairWilliam S Fulton2019-02-131-0/+2
|
* Add missing typedefs to std::mapWilliam S Fulton2019-02-131-0/+6
|
* Add missing parameter names in STL container wrappersWilliam S Fulton2019-02-131-1/+1
| | | | | | | Mostly in STL copy constructors. Best to have parameter names as they make their way into the wrappers in some target languages.
* Create a consistent stl.i library fileWilliam S Fulton2019-02-121-0/+1
| | | | | Same file now for all languages except R which is still missing std_map.i. Recent Java changes adding in std_set.i removed.
* Add support for non-default compare template argument in std::map wrappersWilliam S Fulton2018-10-091-5/+5
|
* Go - use director.swg like other languagesWilliam S Fulton2018-05-062-69/+65
| | | | | | 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).
* Fix directorout typemaps which were causing undefined behaviour when ↵William S Fulton2017-12-141-0/+5
| | | | | | returning pointers by reference. Closes #1167
* Changes to use common DirectorException classWilliam S Fulton2017-11-291-0/+15
| | | | | | | | | | Add director.swg for Go as was completely absent. This is just the start of a common exception handling approach to directors. An exception thrown in a Java director method will be propogated back to Java via a C++ DirectorException. DirectorException throws typemap for Java is fully working, all other languages need work. DirectorException throws typemap for Perl added just to fix compilation errors. Add director_exception_catches test.
* Fix wrapping of references/pointers and qualifiers to member pointersWilliam S Fulton2017-03-161-2/+4
| | | | Also fix Go wrapping of member const function pointers.
* Add <typeinfo> header for std::bad_castDaniel Vollmer2016-09-171-0/+1
|
* Add std::bad_cast to std_except.iDaniel Vollmer2016-09-171-0/+1
| | | | | | This exception occurs when dynamic_cast<T&> fails. Fixes #783.
* Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass ↵William S Fulton2016-05-141-1/+1
| | | | | | by value. Closes #434
* [Go] Fix "in" typemap for char *&.Ian Lance Taylor2016-04-171-4/+5
|
* [Go] Fixes for Go 1.6: avoid returning Go pointers fromIan Lance Taylor2016-04-173-4/+56
| | | | | directors that return string values; add a trailing 0 byte when treating Go string as C char*.
* [Go] Ensure structs are properly packed between gc and GCC/clang.Ian Lance Taylor2016-01-271-2/+20
| | | | From https://github.com/swig/swig/pull/262.
* Revert reference change; update CHANGES.currentRick Luddy2015-09-031-1/+2
|
* Removed golang stringing for signed/unsigned charRick Luddy2015-08-251-25/+9
| | | | | | | With this change, generated code for golang treats char* as a string but treats signed char* and unsigned char* as normal pointers. This seems to fit better with the expected behavior, as the latter are more often used as non-string data.
* [Go] Make sure that arguments for which use memcpy when calling C areIan Lance Taylor2015-05-041-12/+24
| | | | | still live after the call. This ensures that they will not be collected if the GC runs during the call.
* [Go] Add comments telling users that _swig_goallocate andIan Lance Taylor2015-04-171-0/+4
| | | | | | _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.
* [Go] Add -cgo option, required for Go version 1.5 and later.Ian Lance Taylor2015-03-022-4/+63
|
* [Go] Change SWIG directors to use a handle instead of a Go pointer.Ian Lance Taylor2015-02-221-0/+55
| | | | | | | 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.
* Warning fixes in Go cdata libraryWilliam S Fulton2015-02-111-4/+10
| | | | GCC warnings -Wpointer-to-int-cast and -Wdeclaration-after-statement
* [Go] Remove all generated calls to _swig_makegostring, as it will noIan Lance Taylor2015-02-054-16/+189
| | | | | | | | | | | | | | | | | | longer as of Go 1.5. In Go 1.5 or later user calls to _swig_makegostring will fail at link time. Instead, use goout and godirectorin typemaps to allocate strings in Go code. Change the Go typemaps support to ignore empty strings, so that we can define empty strings for regular types so that %apply will override the definitions for string types. Fix the gccgo code to wrap SwigCgoCallback around all godirectorin typemaps. Add a few newlines after typemap code so that the typemaps don't have to include them.
* [Go] Remove all calls to _swig_goallocate in the Go runtime, exceptIan Lance Taylor2015-02-043-16/+142
| | | | | | 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.
* C++11 strongly typed enum fixes for directorsWilliam S Fulton2015-01-151-1/+1
| | | | | Tests added for previous commit. Further refinements to patch #308 and fixes #307.
* [Go] Adjust last patch to avoid write-after-write data race on globalIan Lance Taylor2014-10-141-0/+10
| | | | | | 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.
* [Go] Adjust generated code to work with upcoming Go 1.4 release.Ian Lance Taylor2014-09-251-5/+18
|
* [Go] Add goargout typemap.Ian Lance Taylor2014-09-091-3/+3
|
* Fix go configuration and SWIG_GCC_VERSIONKarl Wette2014-05-021-1/+1
| | | | | | | - 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)