找回密码
 注册
查看: 2870|回复: 0

R语言:dynload()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 18:47:27 | 显示全部楼层 |阅读模式
dynload(base)
dynload()所属R语言包:base

                                        Foreign Function Interface
                                         外部函数接口

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Load or unload DLLs (also known as shared objects), and test whether a C function or Fortran subroutine is available.
加载或卸载的DLL(又称共享对象),一个C函数或Fortran子程序是否是可用的测试。


用法----------Usage----------


dyn.load(x, local = TRUE, now = TRUE, ...)
dyn.unload(x)

is.loaded(symbol, PACKAGE = "", type = "")



参数----------Arguments----------

参数:x
a character string giving the pathname to a DLL, also known as a dynamic shared object.  (See "Details" for what these terms mean.)
一个字符串给一个DLL的路径,也被称为动态共享对象。 (见“详细资料”,这些条款是什么意思。)


参数:local
a logical value controlling whether the symbols in the DLL are stored in their own local table and not shared across DLLs, or added to the global symbol table.  Whether this has any effect is system-dependent. It is ignored on Windows.  
一个逻辑值,控制DLL的符号是否存储在自己的本地表,而不是跨DLL的共享,或添加到全局符号表。是否有任何影响,是依赖于系统。 Windows上被忽略。


参数:now
a logical controlling whether all symbols are resolved (and relocated) immediately the library is loaded or deferred until they are used.  This control is useful for developers testing whether a library is complete and has all the necessary symbols, and for users to ignore missing symbols.  Whether this has any effect is system-dependent. It is ignored on Windows.  
逻辑控制是否都解决了所有的符号(搬迁)立即库被加载或推迟,直到它们被使用。这种控制是有用的测试库是否完整,并拥有所有必要的符号,并为用户忽略缺少符号的开发。是否有任何影响,是依赖于系统。 Windows上被忽略。


参数:...
other arguments for future expansion. See section "Windows" below.  
其他参数为将来的扩展。见节“窗口”下面。


参数:symbol
a character string giving a symbol name.
一个字符串给一个符号名。


参数:PACKAGE
if supplied, confine the search for the name to the DLL given by this argument (plus the conventional extension, ".so", ".sl", ".dll", ...).  This is intended to add safety for packages, which can ensure by using this argument that no other package can override their external symbols.  Use PACKAGE="base" for symbols linked in to R.  This is used in the same way as in .C, .Call, .Fortran and .External functions
如果提供的,限制搜索name这种说法的DLL(加上传统的延伸,.so,.sl,.dll,...)。这是为了增加安全套件,它可以确保使用这种说法,没有其他的包可以覆盖其外部符号。使用PACKAGE="base"链接到R的符号,这是在相同的方式使用.C,.Call,.Fortran和.External功能


参数:type
The type of symbol to look for: can be any ("", the default), "Fortran", "Call" or "External".
寻找符号的类型:可以是任何("",默认),"Fortran","Call"或"External"。


Details

详情----------Details----------

The objects dyn.load loads are called "dynamically loadable libraries" (abbreviated to "DLL" on all platforms except Mac OS X, which unfortunately uses the term for a different sort of sobject.  On Unix-alikes they are also called "dynamic shared objects" ("DSO"), or "shared objects" for short.  (The POSIX standards use "executable object file", but no one else does.)
对象dyn.load负载被称为“动态库”(简称“DLL的所有平台上的Mac OS X除外,这不幸的是使用了不同的排序sobject长期在Unix相似。他们也被称为“动态共享对象(DSO的),或”共享对象“短。(POSIX标准使用可执行对象文件”,但没有人这样做。)

See "See Also" and the "Writing R Extensions" and "R Installation and Administration" manuals for how to create and install a suitable DLL.
看到另见和写R扩展“如何创建和安装一个合适的DLL和R安装和管理手册。

Unfortunately a very few platforms (e.g. Compaq Tru64) do not handle the PACKAGE argument correctly, and may incorrectly find symbols linked into R.
不幸的是,极少数的平台(如康柏Tru64上)不处理PACKAGE参数正确,可能会错误地找到符号链接到河

The additional arguments to dyn.load mirror the different aspects of the mode argument to the dlopen() routine on POSIX systems.  They are available so that users can exercise greater control over the loading process for an individual library.  In general, the default values are appropriate and you should override them only if there is good reason and you understand the implications.
dyn.load的额外参数,反映dlopen()POSIX系统上的常规模式参数不同方面的。它们可个别库,使用户可以行使更大的控制加载过程。在一般情况下,默认值是适当的,如果有很好的理由,你应该重写它们,你理解的影响。

External code must not change the floating point control word, but many DLLs do so.  Common changes are to set it to use 53 bit precision instead of R's default 64 bit precision, or to unmask some exceptions.  dyn.load detects such changes, and restores R's control word to its default value of hex 8001F. This may cause the DLL to malfunction; if so, it should be rewritten to save and restore the control word itself.  If warn.FPU is set to TRUE using the options function, a warning will be printed.  (If the warning says that the control word was changed from some other value than 8001F, please report the circumstances to the Windows maintainers: that probably indicates an internal bug.)
外部代码不能改变的浮点控制字,但很多的DLL这样做。常见的变化是设置使用53位精度,而不是R的默认64位精度,或揭露一些例外。 dyn.load检测到这种变化,并恢复其十六进制8001F默认值R的控制字。这可能会导致故障的DLL,如果这样,它应该被改写,以保存和恢复控制字本身。如果warn.FPU设置为TRUE用options功能,警告将被打印。 (警告说,如果从一些其他值比8001F改变控制字,请报告的情况下,Windows的维护者,这可能表明内部错误。)


值----------Value----------

The function dyn.load is used for its side effect which links the specified DLL to the executing R image.  Calls to .C, .Call, .Fortran and .External can then be used to execute compiled C functions or Fortran subroutines contained in the library.  The return value of dyn.load is an object of class DLLInfo.  See getLoadedDLLs for information about this class.
用于其副作用,连接指定的DLL执行的R图像的功能dyn.load。调用.C,.Call,.Fortran和.External然后可以用来执行编译的C函数或Fortran子程序库中。返回值的dyn.load类DLLInfo是一个对象。看到getLoadedDLLs关于这一类的信息。

The function dyn.unload unlinks the DLL.  Note that unloading a DLL and then re-loading a DLL of the same name may or may not work: on Solaris it uses the first version loaded.
功能dyn.unload断开与该DLL。请注意,卸载DLL,然后再重新加载一个DLL同名的可能或可能无法正常工作:Solaris上使用的第一个版本加载。

is.loaded checks if the symbol name is loaded and hence available for use in .C or .Fortran or .Call or .External.  It will succeed if any one of the four calling functions would succeed in using the entry point unless type is specified.  (See .Fortran for how Fortran symbols are mapped.)
is.loaded检查是否加载符号的名称,因此可以使用.C或.Fortran或.Call或.External。它一定会成功,如果四个调用函数中的任何一个会成功除非type指定使用的入口点。 (见.FortranFortran语言符号如何被映射。)


窗口----------Windows----------

The "standard mechanisms for loading DLLs" include a search order for where a DLL is found (if not given as an absolute path, which is preferred), and of where its dependent DLLs will be found.  This search path depends on the version of Windows and its security settings, but for versions since Windows XP SP1 it is
加载DLL的标准机制,包括一个地方发现一个DLL搜索顺序(如果不是绝对路径,这是首选),依赖于它的DLL会被发现。这个搜索路径取决于版本的Windows和它的安全设置,但自从Windows XP SP1的版本,它是

The directory from which the application was launched.
从该应用程序的启动目录。

The various system directories, e.g. "c:/Windows/system32", "c:/Windows/system" and "c:/Windows".
各系统的目录,例如c:/Windows/system32,c:/Windows/system和c:/Windows。

The current directory.
当前目录。

Along the search path for executables given by the environment variable PATH.
沿线环境变量PATH的可执行文件的搜索路径。

Packages often want to supply dependent DLLs in their "libs" directory, and do this by setting the PATH variable (library.dynam does that automatically in recent versions of R), but the DLL search order means that DLLs in the launch directory and in system directories will be preferred.  On Windows XP SP1 and later there is a way to modify the search order. If argument DLLpath is supplied to dyn.load, the latter makes use of the Windows system call SetDllDirectory to insert the value of DLLpath in second place, and removes the current directory, for the duration of that dyn.load call.  (Note that only one directory can be inserted in this way.)  On Windows 2000, the second item in the search order is the current directory, and the current directory is changed temporarily to implement DLLpath.
软件包往往要依赖DLL,并提供他们的libs目录设置PATH变量(library.dynam可以自动研发的最新版本),但此DLL搜索顺序是指在启动目录和系统目录中的DLL将被优先考虑。在Windows XP SP1和更高版本中,有一种方法来修改搜索顺序。如果参数DLLpathdyn.load提供,后者使Windows系统调用SetDllDirectory插入在第二名DLLpath的价值,使用,并删除当前目录,为dyn.load打电话的时间。 (请注意,只有一个目录可以在这种方式插入。)在Windows 2000,在搜索顺序的第二个项目是当前目录,并在当前目录改变暂时执行DLLpath。


警告----------Warning----------

Do not use dyn.unload on a DLL loaded by library.dynam: use library.dynam.unload. This is needed for system housekeeping.
不使用dyn.unload对library.dynam加载一个DLL:使用library.dynam.unload。这是需要系统的看家。


注意----------Note----------

is.loaded requires the name you would give to .C etc and <STRONG>not</STRONG> (as in S) that remapped by defunct functions symbol.C or symbol.For.
is.loaded需要你的名字会给.C等和<strong>不会</ strong>(在S)倒闭功能重新映射symbol.C或symbol.For。

The creation of DLLs and the runtime linking of them into executing programs is very platform dependent.  In recent years there has been some simplification in the process because the C subroutine call dlopen has become the POSIX standard for doing this.  Under Unix-alikes dyn.load uses the dlopen mechanism and should work on all platforms which support it.  On Windows it uses the standard mechanism (LoadLibrary) for loading DLLs.
DLL和运行执行程序链接到他们的创作是非常依赖于平台。近年来出现了一些简化的过程中,因为在C子程序调用dlopen已成为POSIX标准这样。根据UNIX相似者dyn.load使用dlopen机制,并应支持所有平台上工作。在Windows上使用加载DLL的标准机制(LoadLibrary)。

The original code for loading DLLs in Unix-alikes was provided by Heiner Schwarte.
海纳斯瓦尔特提供原代码的DLL加载在Unix相似者。


参考文献----------References----------

The New S Language. Wadsworth &amp; Brooks/Cole.

参见----------See Also----------

library.dynam to be used inside a package's .onLoad initialization.
library.dynam包.onLoad初始化内使用。

SHLIB for how to create suitable DLLs.
SHLIB如何创造合适的DLL。

.C, .Fortran, .External, .Call.
.C,.Fortran,.External,.Call。


举例----------Examples----------


is.loaded("hcass2") #-&gt; probably TRUE, as stats is loaded[ - >可能是真实的,作为统计加载]
is.loaded("supsmu") # Fortran entry point in stats[在统计的Fortran切入点]
is.loaded("supsmu", "stats", "Fortran")
is.loaded("PDF", type = "External")

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 01:22 , Processed in 0.022514 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表