将静态库链接到 R [英] Linking static library into R

查看:42
本文介绍了将静态库链接到 R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个静态库,我想在我的 R 包中使用它.仅供内部使用.

I have a static library which I am trying to use inside my R package. This is only for internal use.

现在的 libq.a 就在 ./src 文件夹中.我试图将以下内容添加到 src/Makevars:

The libq.a for now is just within ./src folder. I was trying to add the following to src/Makevars:

PKG_LIBS="-l/path/to/lib/libq.a"

其中/path/to/lib 是 libq.a 位置的绝对路径(仅用于测试目的).但这似乎没有帮助.我还需要做其他事情才能加载该静态库吗?

Where /path/to/lib is an absolute path to the libq.a location (for testing purposes only). But that doesn't seem to help. Do I have to do anything else in order to load that static library?

推荐答案

这应该可行——确保在构建包时看到最终链接语句中使用的库.不过请注意,-L 用于补丁,而 -lq 应该是全部.

That should work -- make sure you see the library used on the final link statement when the package is built. Mind you, though, that -L is for the patch and -lq should be all.

也可以直接添加静态库,因此请尝试将 /path/to/lib/libq.a 作为 PKG_LIBS 的参数.

Static libraries can also be added directly so try /path/to/lib/libq.a as is as an argument to PKG_LIBS.

这篇关于将静态库链接到 R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆