我试图从java代码中调用c函数。我正在使用大口(ver1.3.40)并运行在ubunto下。
我的接口文件看起来:
%module test
%include "typemaps.i"
%apply(char *STRING, int LENGTH) {(char* pchInput, int inputSize)};
%{
#include "example.h"
%}
void testFunc(char* pchInput, int inputSize);我得到了以下万宁/错误:警告(453):无法应用(char *STRING,int长度)。没有定义类型映射。
以下链接对我没有帮助:
发布于 2015-08-28 12:01:43
真奇怪。
我用当前的swg3.0.7(将它称为test.i并使用swig -java test.i)尝试了上面的示例,它运行得很好。而且,您不需要使用%include "typemaps.i"才能使其工作。不过,据我所知,这也应该适用于(古)口1.3.40。
发布于 2015-08-27 17:21:39
您需要在使用%include包含标题之前应用您的类型地图,并且应该从常规的#include开始
%module test
%{
#include "example.h"
%}
%include "typemaps.i"
%apply(char *STRING, int LENGTH) {(char* pchInput, int inputSize)};
%include "example.h"其中包含函数声明。尝尝这个
https://stackoverflow.com/questions/32249239
复制相似问题