gpt4 book ai didi

java - 为什么我收到警告(453) Cant apply (char *STRING, int LENGTH) no typemaps are Defined

转载 作者:行者123 更新时间:2023-11-30 15:17:36 25 4
gpt4 key购买 nike

我正在尝试从 java 代码调用 c 函数。我正在使用 swig(1.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 LENGTH)。没有定义类型映射。

以下链接对我没有帮助:

SWIG: Warning 453: Can't apply

SWIG: No typemaps are defined

Swig typemap java object

最佳答案

奇怪。

我用当前的 swig 3.0.7 尝试了上面的示例(将其称为 test.i 并使用 swig -java test.i),它工作正常。此外,您不需要 %include "typemaps.i" 即可正常工作。然而据我所知,这也应该适用于(古老的)swig 1.3.40。

关于java - 为什么我收到警告(453) Cant apply (char *STRING, int LENGTH) no typemaps are Defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32249239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com