mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-27 17:15:27 +02:00

* Update rpicam-still.md * Update jello.md * Update dropdb.md * Update aws-eks.md * Update sfdisk.md * Update hyperfine.md * Update quarto.md * Update for.md * Update coproc.md * Update vagrant-validate.md * Update kubetail.md * Update kubetail.md * Update pstoedit.md * Update highlight.md * Update linode-cli-linodes.md * Update swig.md * Update phpcbf.md * Update unzipsfx.md * Update d8.md * Update trdsql.md * Update keyd.md * Update mamba-repoquery.md * Update pages/common/jello.md * Update coproc.md * Apply suggestions from code review Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> * Update pages/common/for.md Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> * Update for.md --------- Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
21 lines
815 B
Markdown
21 lines
815 B
Markdown
# swig
|
|
|
|
> Generate bindings between C/C++ code and various high level languages such as JavaScript, Python, C#, and more.
|
|
> 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.
|
|
> More information: <https://www.swig.org>.
|
|
|
|
- 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}}`
|
|
|
|
- Generate a binding between C and Ruby and prefix the Ruby module with `foo::bar::`:
|
|
|
|
`swig -ruby -prefix "{{foo::bar::}}" {{path/to/swig_file.i}}`
|