Hi,

When loading a package that provides the user-supplied RNG hook user_unif_rand, calling getNativeSymbolInfo("user_unif_rand") returns informations about the loaded symbol.
I am using this to identify which package currently provides the RNG hook.
The results are the same on windows and linux if only one library provides the hook.

If one loads a second package that provides this hook, then on linux (Ubuntu 10.10), calling again getNativeSymbolInfo("user_unif_rand") returns the latest symbol information (which I presume is the correct result). On windows (XP and Vista) however the symbol information does not change (same pointer address) and the package data is NULL. See results for both systems below. I tested this with R 2.12.1, 2.13.0 and 2.13.1 on Windows.

Is this a normal behaviour for dll loaded on Windows?
Thank you.

Renaud


#####################
# LINUX
#####################
> library(rlecuyer)
> getNativeSymbolInfo("user_unif_rand")
$name
[1] "user_unif_rand"

$address
<pointer: 0x7ff55acffed0>
attr(,"class")
[1] "NativeSymbol"

$package
DLL name: rlecuyer
Filename: /home/renaud/R/x86_64-pc-linux-gnu-library/2.12/rlecuyer/libs/rlecuyer.so
Dynamic lookup: TRUE

attr(,"class")
[1] "NativeSymbolInfo"
> library(rstream)
> getNativeSymbolInfo("user_unif_rand")
$name
[1] "user_unif_rand"

$address
<pointer: 0x7ff55aaf58c0>
attr(,"class")
[1] "NativeSymbol"

$package
DLL name: rstream
Filename: /home/renaud/R/x86_64-pc-linux-gnu-library/2.12/rstream/libs/rstream.so
Dynamic lookup: TRUE

attr(,"class")
[1] "NativeSymbolInfo"

#####################
# WINDOWS
#####################
> library(rlecuyer)
> getNativeSymbolInfo("user_unif_rand")
$name
[1] "user_unif_rand"

$address
<pointer: 0x6bb84fb8>
attr(,"class")
[1] "NativeSymbol"

$package
DLL name: rlecuyer
Filename: C:/Program
        Files/R/R-2.13.1/library/rlecuyer/libs/i386/rlecuyer.dll
Dynamic lookup: TRUE

attr(,"class")
[1] "NativeSymbolInfo"
> library(rstream)
> getNativeSymbolInfo("user_unif_rand")
$name
[1] "user_unif_rand"

$address
<pointer: 0x6bb84fb8>
attr(,"class")
[1] "NativeSymbol"

$package
NULL

attr(,"class")
[1] "NativeSymbolInfo"








###
UNIVERSITY OF CAPE TOWN
This e-mail is subject to the UCT ICT policies and e-mai...{{dropped:5}}

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to