On 11-08-07 8:09 PM, Alexandre Aguiar wrote:> Hi.
>
> Need some advice. I have to load a library during R_init_XXXXX() with
> dlopen(). The library file is 23 megabytes long and loads several other
> libraries. Everything happens during dlopen() execution, out of control,
> and takes around 1 second on first load in a quadcore. Besides, due to
> security reasons, a hash of the library file is going to be computed.
> Still do not know how long it will take.
>
> Questions.
>
> Is 1 second acceptable for R? Slower machines may take a lot longer to
> return from R_init_XXXXX(). Does R_init_XXXXX() have to return soon or
> call R_CheckUserInterrupt()? Or is it somehow free from this R need?
R won't care if interrupts aren't called. It will be unresponsive
during that time, so your users might not like it, but presumably
they'll know what to expect.
>
> Is it safe to load the second library and compute the hash within other
> threads so R_init_XXXXX goes on? If some function of my extension library
> is called it can call R_CheckUserInterrupt() if and while the threads do
> not end. If such use of threads is safe inside R, is there a package that
> does it? Any tips?
R is not thread safe, so your other threads have to avoid any calls to
R.>
> Flags currently sent to dlopen are (RTLD_LAZY | RTLD_LOCAL). Revolving the
> R sources could not find the flags R uses. Does any of you know for sure
> the flags used to load extensions with loadLibrary()? Looking into
> computeDLOpenFlag() did not answer the question. Is there a recommended
> flags set in this situation?
You don't say what OS you're working on.
Duncan Murdoch
>
> Aparently dlopen() flags LM_ID_BASE and RTLD_GROUP (their use sounds wise)
> are not defined in Linux. Is this correct or I missed something?
>
> Thanks.
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.