2020-04-01 02:17:09 +02:00
# swig
2023-06-13 22:44:43 +05:30
> Generate bindings between C/C++ code and various high level languages such as JavaScript, Python, C#, and more.
2024-02-14 17:25:13 -03:00
> It uses special `.i` or `.swg` files to generate the bindings (C/C++ with SWIG directives, then outputs a C/C++ file that contains all the wrapper code needed to build an extension module.
2024-10-12 10:02:00 +02:00
> More information: <https://www.swig.org>.
2020-04-01 02:17:09 +02:00
- Generate a binding between C++ and Python:
`swig -c++ -python -o {{path/to/output_wrapper.cpp}} {{path/to/swig_file.i}}`
- Generate a binding between C++ and Go:
`swig -go -cgo -intgosize 64 -c++ {{path/to/swig_file.i}}`
- Generate a binding between C and Java:
`swig -java {{path/to/swig_file.i}}`
2023-11-12 04:08:58 +01:00
- Generate a binding between C and Ruby and prefix the Ruby module with `foo::bar::` :
2020-04-01 02:17:09 +02:00
`swig -ruby -prefix "{{foo::bar::}}" {{path/to/swig_file.i}}`