[Rd] makeNamespace and rdyncall

Hadley Wickham hadley at rice.edu
Fri Dec 16 14:11:10 CET 2011


This is also something I'd appreciate for the devtools package.
Hadley

On Fri, Dec 16, 2011 at 7:36 AM, Daniel Adler <dadler at uni-goettingen.de> wrote:
> Dear R Core Team,
>
> I have a question related to the programming interface for namespace object creation at run-time.
>
> This is something that I need in the rdyncall package:
> During the dynamic linkage binding of a shared C library, an R namespace object is created
> that gets populated with call wrappers, symbolic constants and type information objects.
>
> For example,
>
>> dynport(SDL) # create namespace, populated with wrappers to SDL library
>> search()     # gives a "package:SDL" populated with all kinds of wrappers to the C functions, etc..
> [1] ".GlobalEnv"        "package:SDL"
>
> I was trying various alternatives to get package-behaviour implemented in transparent manner for the end-user.
>
> The current version uses real namespace environments with all sorts of advantages such as support for
> search(), detach() and '::'.
>
> Namespace object have certain conventions for fields, and there is currently no
> public interface available in 'base' for setting up such objects;
> The function "makeNamespace" in src/library/base/namespace.R is defined as local function to "loadNamespace".
> So I go about this problem by 'copying' the code.
>
> Recently, R-2.14 introduced a new mandatory field 'lazyData' which mades rdyncall broken.
> (By re-synchronizing with 'makeNamespace' it has been fixed in 0.7.4.)
>
> Would it be possible and feasible to make namespace-related management functions such as makeNamespace and sealNamespace
> available as an public accessible interface? Or at least accessible via ':::' ?
>
> I would also appreciate any hint/idea for alternative ways to implement the above described behaviour.
>
> Here is the link to the code used for creation of dynamic C binding namespaces: http://dyncall.org/svn/dyncall/trunk/bindings/R/rdyncall/R/dynport.R
>
> best wishes,
> - Daniel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list