[R-pkg-devel] Calling R's tempdir() from C
Rodrigo Tobar
rtob@r @ending from icr@r@org
Fri Aug 10 16:07:25 CEST 2018
Hi,
On 10.08.18 3:10 PM, Duncan Murdoch wrote:
> On 10/08/2018 12:01 AM, Rodrigo Tobar wrote:
>> [...]
>
> Why not pass the result of tempdir() in your call from R to your C++
> function, or in an initialization call for your package? It won't
> change during a session.
This is indeed a good suggestion, but (my bad!) I forgot to mention: the
place I need to use this is at dynlib loading time (i.e., when
R_init_mypackage is called), so I don't have the flexibility to pass
arbitrary arguments.
I guess this is a separate but related question, but it's not clear to
me if in the process of loading a package, any particular piece of R
code is guaranteed to execute before the library is loaded; otherwise I
could pass down the information by setting an environment variable in R
and read it from C++, or even perform all the directory creation logic
at the R level.
Thanks again,
Rodrigo
More information about the R-package-devel
mailing list