我应该为“外部”编写“.registration = true”吗? R 包中的 DLL?
当我制作一个包含一些 C 代码或使用 Rcpp 的包时,我输入 roxygen 代码:
#' @useDynLib TheDLL, .registration=true
我制作了一个包,其中包含一些用 Haskell 创建的 DLL,我将其放入 inst/ libs 文件夹。我没有在 roxygen 代码中输入 .registration=true
并且该包工作正常。我仍然应该输入它吗?如果是这样,.registration=true
的作用是什么?
When I do a package including some C code or using Rcpp, I type the roxygen code:
#' @useDynLib TheDLL, .registration=true
I did a package in which I included some DLLs created with Haskell, that I put in the inst/libs folder. I didn't type .registration=true
in the roxygen code and the package works fine. Should I type it nevertheless? If so, what is the role of .registration=true
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您几乎肯定不应该在通用 DLL 中使用它,但如果该 DLL 是专门为 R 编写的,也许您应该这样做。它表明 dll 从其
R_init_DLLNAME
函数中调用R_registerRoutines
,因此入口点可以保存到变量中。例如,您可能有一个名为“foo”的函数。您可以使用调用它而无需注册它,并且 R 将需要在运行时搜索符号表。或者你可以注册它并调用它,
并且不需要搜索。这主要在 "Writing 的 5.4.2 节中讨论R 扩展”。我相信,如果您指定
.registration=true
,那么R将使用注册信息来查找入口点,否则它需要搜索DLL的所有导出,这可能会更慢。I think you almost certainly shouldn't use it in a general-purpose DLL, but if the DLL was written specifically for R, maybe you should. It indicates that the dll calls
R_registerRoutines
from itsR_init_DLLNAME
function, so entry points can be saved into variables. For example, you might have a function named "foo". You can call it usingwithout registering it, and R will need to search symbol tables for it at run time. Or you can register it and call it as
and the search is unnecessary. This is discussed mainly in section 5.4.2 of "Writing R Extensions". I believe that if you specify
.registration=true
then R will use the registration information to find entry points, otherwise it needs to search through all the exports of the DLL, which is probably slower.