Android NDK: From Elementary to Expert Episode 5

Install Swig

There is no difference in Android Studio. We need to download the code from official website and you can get the file from the fellow link:

http://prdownloads.sourceforge.net/swig/swigwin-3.0.12.zip

Then, extract the file into the specific destination such as D:\setup\tools.
Similar to the other development tools that you have installed, in order to have SWIG easily reachable, its destination directory should be appended to system executable search path. Launch the Environment Variables dialog from System Properties, and click the New button. Using the New System Variable, set the variable name to SWIG_HOME and the variable value to the SWIG installation directory.

From the list of system variables, double-click on the PATH variable, and append ;%SWIG_HOME% to the variable value.

If the installation was successful, you will see the SWIG version number.

Interface File

SWIG interface files contain function prototypes, classes, and variable declarations. Its syntax is the same as any ordinary C/C++ header file. In addition to C/C++ keywords and preprocessor directives that can enable tuning the generated wrapper code.

There is no method to integrate SWIG into Android build process in Android Studio(Windows). When processing, it will prompt some errors, which needs further research and discussion.

The example code is offered by sureshjoshi. It is incompleted, however, which obviously has some fatal errors. So I turn to the project:
https://github.com/tankery/swig-ndk-gradle

This project could generate the code in Java manually. Therefore, it can be further investigation of the usage of SWIG.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值