Skip to content

external pointers

5 messages · Mark Bravington, Roger Bivand, Brian Ripley +1 more

#
Hi Simon

Thanks for that... see below for my feeble counterblasts! (And two
questions.)
Very true, though 64 bit systems are not a big worry for Delphi 6.0
writers... ;) I did once speculate about hacking around this sort of
thing by encoding into character strings instead of integers, uggg.
Sorry, that was lack of clarity on my part about what I meant by
"persistent". Whenever I use this mechanism, I'm careful to ensure that
the C/Delphi objects only have lifetimes *within* a function, and to
include an 'on.exit' call to the "destructor"-- I would never  create
global objects pointing to ephemeral C structures. Admittedly, this
relies on programming self-discipline, and has no cast-iron anti-nirvana
mechanism! Ross' original query seems very much along these lines,
though.

If I was really creating global persistent objects, then 'externalptr'
would definitely be much better.

Where would be best to read about externalptr? I'm having trouble
finding material in the manuals or the site-search.

And would I need to use all the .Call machinery and C headers and SEXP
etc in order to handle externalptr objects?
bye
Mark
#
On Mon, 12 Dec 2005 Mark.Bravington at csiro.au wrote:

            
One package using externalptr is rgdal - Tim Keitt wrote the bindings to
the external GDAL library for reading raster images to first return a
pointer to a dataset (on disk) opened by GDAL, then to use the object to
retrieve (parts of) the data. Most of the .Call/SEXP machinery is there
(for the C++ case, GDAL is C++, so GDAL manages its own memory for its
objects). The package also uses S4 classes, which may be overkill for your
purposes.

Roger

  
    
#
On Mon, 12 Dec 2005, Roger Bivand wrote:

            
RODBC is another, somewhat simpler, one.

There is documentation on developer.r-project.org, but my recollection is 
that is was not up to date (and in particular not re finalizers).  On my 
TODO list is to add end-user documentation to `Writing R Extensions'.
#
There's also Luke's own site, in particular http://www.stat.uiowa.edu/ 
~luke/R/weakfinex.html
On Dec 12, 2005, at 12:16 AM, Prof Brian Ripley wrote:

            
---
Byron Ellis (ellis at stat.harvard.edu)
"Oook" -- The Librarian
#
On Mon, 12 Dec 2005, Byron Ellis wrote:

            
Hmm, that _is_ a link on the page I pointed you to, under its actual 
subject, weak references.