Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: add option to propagate '-D' flags to SWIG #36623
Related with #18339.
When building a package using go + swig, it would be great if we could provide custom flags to swig (specially -D flags).
One example where this would be needed is when we need to pass -DSWIGWORDSIZE64 or -DSWIGWORDSIZE32 so swig can properly generate its bindings.
#18339 was about adding a
Would that fix your problem?
We didn't implement #18339 because nobody provided a compelling use case. What is your compelling use case? The SWIG libraries themselves don't use
I believe it would fix. SWIG tries to determine the word size (see https://github.com/swig/swig/blob/master/Lib/swigarch.i) and this can also be explicit defined if one sets -DSWIGWORDSIZE32 or -DSWIGWORDSIZE64.
The main problem here is that if this is not set and any of the defines used in swigarch (namely
This is a problem for some x64 architectures as swig wrongly generates bindings considering a word size of 32 instead of 64 (see https://github.com/swig/swig/blob/master/Lib/stdint.i).
What I am currently doing as a workaround is to generate a swig interface containing these defines (obtained from cc) every time I build my application, however I feel like go should let us pass this kind of flags instead.