Hi Martin,

oups... I indeed had not seen this reply (maybe I should drink less water).
Thank you and sorry for the gross bump.

Duncan, thank you for the work around. A cache issue makes sense as 
shown by the sample code in my bump-post.
The cache could be updated when loading a new DLL, by looking up it 
symbols against the cache.

Another issue is illustrated by the following calls:

library(rstream)
getNativeSymbolInfo("user_unif_rand", "rstream")
getNativeSymbolInfo("user_unif_rand", "rstream")

Although one specifies the package here, the results are different (see 
below: the first returns the complete information, the second has a NULL 
element package).

I noticed other issues which makes very difficult to predict which DLL 
will actually be resolved (e.g. when one plays with loading/unloading 
packages that provides the hook), but I guess caching is behind all these.

Renaud

################
 > library(rstream)
 > getNativeSymbolInfo("user_unif_rand", "rstream")
$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"
 > getNativeSymbolInfo("user_unif_rand", "rstream")
$name
[1] "user_unif_rand"

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

$package
NULL

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



On 23/08/2011 17:58, Martin Morgan wrote:
> Hi Renaud -- did you miss this
>
> https://stat.ethz.ch/pipermail/r-devel/2011-August/061812.html
>
> ? Martin
>
> On 08/23/2011 07:40 AM, Renaud Gaujoux wrote:
>> 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}}
>>
>> ______________________________________________
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



###

UNIVERSITY OF CAPE TOWN 

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

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

Reply via email to