[Rd] [rfc] Package to access the internal zlib library.

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 30 10:20:13 CET 2008


On Wed, 30 Jan 2008, jason at acm.org wrote:

> To make R.matlab's readMat work for me[1] I needed access to zlib's
> uncompress function.  R already links with zlib, and sometime last

Not so: R can be linked to the system's zlib, and otherwise uses its own 
copy which is not intended for use by packages.

Please check what 'Writing R Extensions' says about using undocumented 
entry points in R.  Ideally none of zlib would be visible, but some 
packages have been making use of undocumented entry points and we took 
pity on them.

Your package will not work as it does not include the header zlib.h, and 
e.g. Windows does not have it.  Expecting the system's zlib.h to work with 
R's internal copy is unsafe.

The *only* safe thing to do is to include your own copy of zlib, and 
compile it into the package (optionally linking instead to the system copy 
if it exists).


> year I hobbled together a quick package to get at a few functions.
> It's my first package, so I would love feedback both on the package
> and its purpose.
>
> I've dropped a temporary copy at
>  http://jriedy.users.sonic.net/internalzlib_0.1.tar.gz
>
> Could someone with Windows and knowledge of how to decypher Windows
> problems test if it works for them?  I still need to try AIX as well.

Please note that Uwe Ligges provides a Windows testing service: see 
'Writing R Extensions' and the R-admin manual.  You don't need to ask 
others to do this for you.

>
> Jason
>
> Footnotes:
> [1]  I'm cleaning patches to send to the author shortly.  I think
> I have readMat working for compressed data, UTF-*, and sparse
> matrices now.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list