From renaud at mancala.cbio.uct.ac.za  Tue Aug 23 16:40:19 2011
From: renaud at mancala.cbio.uct.ac.za (Renaud Gaujoux)
Date: Tue, 23 Aug 2011 16:40:19 +0200
Subject: [Rd] getNativeSymbolInfo("user_unif_rand") returns different
 results on windows and linux
Message-ID: <4E53BBD3.7050907@cbio.uct.ac.za>

Hi,

sorry to bump this post but I did not get any reply on this puzzling 
issue, which looks important though.

While investigating the issue it came out that the value returned by 
getNativeSymbolInfo('user_unif_rand') (on Windows XP) seems to depend on 
whether it has already been called on the same symbol (see test code 
below. Each sequence needs to be run on on a fresh R session).

Things works perfectly under Linux.

Thank you for any explanation on the matter.

Renaud

########## SEQUENCE 1 ##################
library(rstream)
getNativeSymbolInfo('user_unif_rand')
# this returns complete info pointing to rstream's hook
#### RESULT
$name
[1] "user_unif_rand"

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

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

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

# call again getNativeSymbolInfo
getNativeSymbolInfo('user_unif_rand')
# this returns INcomplete info pointing to rstream's hook
### RESULT
$name
[1] "user_unif_rand"

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

$package
NULL

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


########## SEQUENCE 2 ##################
library(rstream)
library(rlecuyer)
getNativeSymbolInfo('user_unif_rand')
# this returns complete info pointing to relcuyer's hook
########## RESULT ##################
$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"
############################

########## SEQUENCE 3 ##################
####### Load library that provides a hook for user_unif_rand
library(rstream)
getNativeSymbolInfo('user_unif_rand')
# this returns complete info pointing to rstream's hook
## RESULT ##
$name
[1] "user_unif_rand"

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

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

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

####### Load other library that provides the hook
library(rlecuyer)
getNativeSymbolInfo('user_unif_rand')
# this returns INcomplete info pointing to rstream's hook
## RESULT ##
$name
[1] "user_unif_rand"

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

$package
NULL

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


 > sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_South Africa.1252  LC_CTYPE=English_South 
Africa.1252
[3] LC_MONETARY=English_South Africa.1252 LC_NUMERIC=C 

[5] LC_TIME=English_South Africa.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rlecuyer_0.3-1 rstream_1.3.1



###

UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mai...{{dropped:5}}



[Rd] getNativeSymbolInfo("user_unif_rand") returns different results on windows and linux
Renaud Gaujoux