0
我想生成下面的C函数R(编程语言)包装:如何为返回int *的C函数生成R封装器?
int *test(void)
{
int i;
i = 1024;
return (int *) i;
}
为了创建这个包装,我使用痛饮具有以下接口:
%module X
%{
extern int *test(void);
%}
extern int *test(void);
我可以成功创建并编译这个包装器。然而,当我运行下列R-代码(包装被预先加载):
print(test())
它会给以下错误:
Error in getClass(Class, where = topenv(parent.frame())) :
“_p_int” is not a defined class
Calls: print -> test -> new -> getClass
我的问题是:我怎么可以包装的C test
函数(更确切地说是由此函数返回的int *
)?
感谢您的建议@Dirk。 SWIG呢? – user7698505
你读过我写的第一句话吗?我不知道,我怀疑许多其他人。在遥远的过去,我已经使用了一次或两次,但这些本地到R的软件包对于R_的使用更具性能。 –