简体   繁体   English

如何从C ++生成SWIG接口?

[英]How to generate SWIG interface from C++?

Is there any way generate SWIG interface from existing C++ code, if I want to expose everything one-to-one for my Java application? 如果我想为我的Java应用程序一对一地公开所有内容,有什么方法可以从现有的C ++代码生成SWIG接口?

To clarify, this is 3rd-party library and I don't have headers for top level files to generate interface from them. 要澄清的是,这是第三方库,我没有顶级文件的标头来从它们生成接口。

Because you don't have access to the header files, your only option is libraries that directly introspect the C++-based binaries. 因为您无权访问头文件,所以唯一的选择是直接内省基于C ++的二进制文件的库。 I would start by taking a look at JNA: it is the java equivalent of lua's libffi and python's ctypes. 我先看一下JNA:它等效于lua的libffi和python的ctypes的java。 Since you need C++, look then at BridJ, nativelibs4java and JNAerator. 由于您需要C ++,因此请看一下BridJ,nativelibs4java和JNAerator。 I haven't used any so can't comment on their robustness or power. 我没有使用过,因此无法评论其健壮性或功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM