Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
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.
The text was updated successfully, but these errors were encountered:
#18339 was about adding a SWIGFLAGS environment variable similar to CFLAGS, for flags to pass to SWIG.
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 SWIGWORDSIZE64; what would you use it for?
Sorry, something went wrong.
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 __WORDSIZE, __x86_64 and __x86_64__) are set, swig will automatically set the word size as 32.
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.
No branches or pull requests