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
This commit is contained in:
Ian Lance Taylor 2012-10-05 04:58:00 +00:00
commit a42882dcee
5 changed files with 124 additions and 27 deletions

View file

@ -5,12 +5,32 @@
* ------------------------------------------------------------ */
%insert(runtime) %{
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
typedef struct { char *p; int n; } _gostring_;
typedef struct { void* array; unsigned int len; unsigned int cap; } _goslice_;
%}
#if SWIGGO_INTGO_SIZE == 32
%insert(runtime) %{
typedef int intgo;
%}
#elif SWIGGO_INTGO_SIZE == 64
%insert(runtime) %{
typedef long long intgo;
%}
#else
%insert(runtime) %{
typedef ptrdiff_t intgo;
%}
#endif
%insert(runtime) %{
typedef struct { char *p; intgo n; } _gostring_;
typedef struct { void* array; intgo len; intgo cap; } _goslice_;
%}