首页 > 其他分享 >SWIG:SWIG的简介、安装、使用方法之详细攻略

SWIG:SWIG的简介、安装、使用方法之详细攻略

时间:2022-11-07 14:04:05浏览次数:64  
标签:wrappers default 简介 SWIG Display 攻略 debug Generate

SWIG:SWIG的简介、安装、使用方法之详细攻略

一个处女座的程序猿

于 2019-12-16 10:57:12 发布

14957
收藏 58
分类专栏: Tool/IDE etc
版权

Tool/IDE etc
专栏收录该内容
72 篇文章19 订阅
订阅专栏
SWIG的简介、安装、使用方法之详细攻略

 

 

目录

SWIG的简介

SWIG的安装

SWIG的使用方法

 

 

 

 

SWIG的简介
SWIG是一种软件开发工具,它将C和C++编写的程序与各种高级编程语言连接起来。SWIG用于不同类型的目标语言,包括常见的脚本语言,如Javascript、Perl、PHP、Python、Tcl和Ruby。支持的语言列表还包括非脚本语言,如C#,D,Go language,Java,包括Android,Lua,OCaml,Octave,Scilab和R。还支持几种解释和编译的Scheme实现(Guile,MzScheme/Racket)。
SWIG最常用于创建高级解释或编译的编程环境、用户界面,以及作为测试和原型化C/C++软件的工具。SWIG通常用于解析C/C++接口,并生成用于上述目标语言调用C/C++代码所需的“胶粘代码”。SWIG还可以XML格式导出解析树。SWIG是自由软件,SWIG生成的代码与商业和非商业项目都兼容。

SWIG官网:http://www.swig.org/

 

SWIG的安装
下载地址:https://sourceforge.net/projects/swig/files/swig/swig-4.0.1/swig-4.0.1.tar.gz/download?use_mirror=nchc
注:切记,下载的时候要选择对应的系统,比如博主选择的是Win10系统对应的swigwin-4.0.1压缩包。

安装教程:

 

 

 

 

SWIG的使用方法

C:\Users>swig -help
Supported Target Language Options
     -csharp         - Generate C# wrappers
     -d              - Generate D wrappers
     -go             - Generate Go wrappers
     -guile          - Generate Guile wrappers
     -java           - Generate Java wrappers
     -javascript     - Generate Javascript wrappers
     -lua            - Generate Lua wrappers
     -octave         - Generate Octave wrappers
     -perl5          - Generate Perl 5 wrappers
     -php7           - Generate PHP 7 wrappers
     -python         - Generate Python wrappers
     -r              - Generate R (aka GNU S) wrappers
     -ruby           - Generate Ruby wrappers
     -scilab         - Generate Scilab wrappers
     -tcl8           - Generate Tcl 8 wrappers
     -xml            - Generate XML wrappers
Experimental Target Language Options
     -mzscheme       - Generate MzScheme/Racket wrappers
     -ocaml          - Generate OCaml wrappers
General Options
     -addextern      - Add extra extern declarations
     -c++            - Enable C++ processing
     -co <file>      - Check <file> out of the SWIG library
     -copyctor       - Automatically generate copy constructors wherever possible
     -cpperraswarn   - Treat the preprocessor #error statement as #warning (default)
     -cppext <ext>   - Change file extension of generated C++ files to <ext>
                       (default is cxx)
     -copyright      - Display copyright notices
     -debug-classes  - Display information about the classes found in the interface
     -debug-module <n>- Display module parse tree at stages 1-4, <n> is a csv list of stages
     -debug-symtabs  - Display symbol tables information
     -debug-symbols  - Display target language symbols in the symbol tables
     -debug-csymbols - Display C symbols in the symbol tables
     -debug-lsymbols - Display target language layer symbols
     -debug-tags     - Display information about the tags found in the interface
     -debug-template - Display information for debugging templates
     -debug-top <n>  - Display entire parse tree at stages 1-4, <n> is a csv list of stages
     -debug-typedef  - Display information about the types and typedefs in the interface
     -debug-typemap  - Display typemap debugging information
     -debug-tmsearch - Display typemap search debugging information
     -debug-tmused   - Display typemaps used debugging information
     -directors      - Turn on director mode for all the classes, mainly for testing
     -dirprot        - Turn on wrapping of protected members for director classes (default)
     -D<symbol>      - Define a symbol <symbol> (for conditional compilation)
     -E              - Preprocess only, does not generate wrapper code
     -external-runtime [file] - Export the SWIG runtime stack
     -fakeversion <v>- Make SWIG fake the program version number to <v>
     -fcompact       - Compile in compact mode
     -features <list>- Set global features, where <list> is a comma separated list of
                       features, eg -features directors,autodoc=1
                       If no explicit value is given to the feature, a default of 1 is used
     -fastdispatch   - Enable fast dispatch mode to produce faster overload dispatcher code
     -Fmicrosoft     - Display error/warning messages in Microsoft format
     -Fstandard      - Display error/warning messages in commonly used format
     -fvirtual       - Compile in virtual elimination mode
     -help           - Display help
     -I-             - Don't search the current directory
     -I<dir>         - Look for SWIG files in directory <dir>
     -ignoremissing  - Ignore missing include files
     -importall      - Follow all #include statements as imports
     -includeall     - Follow all #include statements
     -l<ifile>       - Include SWIG library file <ifile>
     -macroerrors    - Report errors inside macros
     -makedefault    - Create default constructors/destructors (the default)
     -M              - List all dependencies
     -MD             - Is equivalent to `-M -MF <file>', except `-E' is not implied
     -MF <file>      - Generate dependencies into <file> and continue generating wrappers
     -MM             - List dependencies, but omit files in SWIG library
     -MMD            - Like `-MD', but omit files in SWIG library
     -module <name>  - Set module name to <name>
     -MP             - Generate phony targets for all dependencies
     -MT <target>    - Set the target of the rule emitted by dependency generation
     -nocontract     - Turn off contract checking
     -nocpperraswarn - Do not treat the preprocessor #error statement as #warning
     -nodefault      - Do not generate default constructors nor default destructors
     -nodefaultctor  - Do not generate implicit default constructors
     -nodefaultdtor  - Do not generate implicit default destructors
     -nodirprot      - Do not wrap director protected members
     -noexcept       - Do not wrap exception specifiers
     -nofastdispatch - Disable fast dispatch mode (default)
     -nopreprocess   - Skip the preprocessor step
     -notemplatereduce - Disable reduction of the typedefs in templates
     -O              - Enable the optimization options:
                        -fastdispatch -fvirtual
     -o <outfile>    - Set name of C/C++ output file to <outfile>
     -oh <headfile>  - Set name of C++ output header file for directors to <headfile>
     -outcurrentdir  - Set default output dir to current dir instead of input file's path
     -outdir <dir>   - Set language specific files output directory to <dir>
     -pcreversion    - Display PCRE version information
     -small          - Compile in virtual elimination and compact mode
     -swiglib        - Report location of SWIG library and exit
     -templatereduce - Reduce all the typedefs in templates
     -v              - Run in verbose mode
     -version        - Display SWIG version number
     -Wall           - Remove all warning suppression, also implies -Wextra
     -Wallkw         - Enable keyword warnings for all the supported languages
     -Werror         - Treat warnings as errors
     -Wextra         - Adds the following additional warnings: 202,309,403,405,512,321,322
     -w<list>        - Suppress/add warning messages, eg -w401,+321 - see Warnings.html
     -xmlout <file>  - Write XML version of the parse tree to <file> after normal processing
Options can also be defined using the SWIG_FEATURES environment variable, for example:
  $ SWIG_FEATURES="-Wall"
  $ export SWIG_FEATURES
  $ swig -python interface.i
is equivalent to:
  $ swig -Wall -python interface.i
Arguments may also be passed in a file, separated by whitespace. For example:
  $ echo "-Wall -python interface.i" > args.txt
  $ swig @args.txt
Note: 'swig -<lang> -help' displays options for a specific target language.

 


————————————————
版权声明:本文为CSDN博主「一个处女座的程序猿」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_41185868/article/details/103558686

标签:wrappers,default,简介,SWIG,Display,攻略,debug,Generate
From: https://www.cnblogs.com/sexintercourse/p/16865695.html

相关文章

  • SWIG初体验
    SWIG是什么SWIG,SimplifiedWrapperandInterfaceGenerator,这是一个封装C/C++动态库供其他编程语言调用的神器。以Java为例,想通过JAVA程序调用C/C++动态库的话,就必须......
  • Web前端技术简介
    Web前端就是1美工photoshop、css2界面友好(比如京东=,你购物以后的关联产品是放在左边还是右边呢?)3强大的脚本功能支持(QQ空间,上传照片,重新部署......
  • 汽车常识之动力系统简介
    前言在人生的道路上,从来没有全身而退,坐享其成,不劳而获一说。你不努力,就得出局。一、动力系统简介是给汽车提供驱动力的总要部件;包含发动机、电动机、发电机、动力电池......
  • 01 Sonic - 简介
    1、开源测试工具Sonic介绍​​开源云真机测试平台开源啦!-设计思路与背景(一)​​2、官网​​https://sonic-cloud.gitee.io/#/Home​​ 3、源码git地址​​https://github......
  • Emmet 简介、语法和速查
    1 Emmet简介Emmet是一个文本编辑器/IDE的插件,使用Emmet通过简短的表达式来快速生成复杂的HTML/CSS代码片段,只要掌握一些常用的语法,可以减少重复编码的工作,帮助我们快速开发......
  • 一张图展示齐博X1目录结构简介
    这里所写的就是比较重要的.需要大家了解的.没标注的.就是大家可以不需要了解的.因为用的不多的.大家无需关注的.点击查看大图......
  • Sql Server性能排查和优化懒人攻略
    转载自作者zhang502219048的微信公众号【SQL数据库编程】:SqlServer性能排查和优化懒人攻略很多年前,笔者那时刚从广东技术师范学院(现为广东技术师范大学,以前为广......
  • Numpy与Pandas简介
    一、Numpy与Pandas是什么?Numpy(NumericalPython)是Python语言的一个第三方库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。Numpy是一个运行......
  • AOP-简介,面向切面编程好处,AOP编程术语,AspectJ(通知类型,切入点表达式)
    AOP概述1.AOP简介AOP(AspectOrientProgramming),面向切面编程。面向切面编程是从动态角度考虑程序运行过程。AOP底层,就是采用动态代理模式实现的。采用了两种代......
  • 比特币与以太坊的基本知识简介
    比特币是由中本聪提出的一种数字货币。比特币不依靠任何货币机构,是一种去中心化的记账机制,由所有节点共同维护一个账本,用户的比特币信息通过这个账本计算所得。POW比特......