在R包加载已编译的库
问题说明
我正在编写一个R包,其中需要将一个已编译的库文件qserver.dll包含在内,并在将该包加载到R到整个库(myPackage)中时dym.load.该qserver.dll由第三方供应商提供,所以我没有源代码.
I am writing an R package where I need to include a compiled library file qserver.dll and dym.load it when the package is loaded in R throught library(myPackage). This qserver.dll is provided by a third party vendor so I don't have the source code.
我在互联网上做了一些研究,但是信息很少.到目前为止,我发现我应该将此文件放在包文件夹的inst/子目录中.但是,在编写程序包时如何确定该文件的路径,以便可以编写类似
I did some research on the internet but information is rare. What I have found so far is that I should put this file in the to inst/ subdirectory of my package folder. However, how I can determine the path to this file when writing the package so I can write something like
dyn.load("path/to/file/qserver.dll")
编写程序包时.非常感谢.
when writing the package. Thanks very much.
正确答案
可通过以下方式使用包的inst
目录中的项目:
Items in the inst
directory of a package are made available through
system.file(..., package=<mypkg>)
因此,假设您在包路径<pkg>/inst/lib/qserver.dll
中包含了.dll
,则可以
so assuming you had that .dll
in a package path <pkg>/inst/lib/qserver.dll
, you can do
system.file("lib/qserver.dll", package=<mypkg>)
获取文件位置.
现在,当然,这是CRAN不能接受的,并且 CRAN储存库政策对此很清楚.因此,如果您确实需要qserver.dll
,则要么需要找到源代码,要么考虑使用其他分发途径.
Now, of course, this is not CRAN acceptable, and the CRAN Repository Policy is quite clear on this. So if you really need qserver.dll
, either you need to find the source code, or consider a different route for distribution.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcajjkk
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20