From p.dalgaard at biostat.ku.dk  Sun Nov 30 12:17:43 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Sun Nov 30 12:07:52 2003
Subject: [Rd] R as OS X Framework
In-Reply-To: <Pine.LNX.4.44.0311300729260.23674-100000@gannet.stats>
References: <Pine.LNX.4.44.0311300729260.23674-100000@gannet.stats>
Message-ID: <x2ekvq2jhk.fsf@biostat.ku.dk>

Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:

> On Sat, 29 Nov 2003, Simon Urbanek wrote:
> 
> > The current R needs R_HOME to be set before using it even in its 
> > embedded form. Now this defeats the idea of location independence of 
> > the framework. The application doesn't have to care whether the 
> > framework is in /Library/Frameworks, ~/Library/Frameworks or any 
> > user-defined framework location. Therefore it would be nice to have a 
> > tiny function in the R shlib, that would tell me where the shlib lives 
> > (either by using system's API to determine its own location, or at 
> > least the path used on installation).
> > 
> > BTW: This is not Mac specific - I was fighting this on Windows (and 
> > unix for that matter) as well - it is possible to run an .exe linked to 
> > R.dll from anywhere, if R.dll is in the PATH. But then, one has to 
> > determine R_HOME somehow (yes, there is the registry, but that's not 
> > really safe if more R versions are installed).
> 
> How do you do that?  For R's own executables on Windows R_HOME is
> determined from where they are loaded from.  You cannot AFAIK determine
> from within an executable where the R.dll was linked from.  That's why the
> rproxy.dll uses the registry.  I believe you have even less information on 
> Windows.

..than on Windows? Did you mean Unix there? 

Finding the full path name of the current executable is a well-known
impossible under Unix (there's no enforced relation between the
executable and what goes in argv[0]). Doesn't keep applications from
trying anyway, and mostly succeeding. E.g. Tcl has Tcl_FindExecutable.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] R as OS X Framework
Peter Dalgaard