From murdoch@stats.uwo.ca  Mon Dec  2 15:17:02 2002
From: murdoch@stats.uwo.ca (Duncan Murdoch)
Date: Mon Dec  2 15:17:02 2002
Subject: [Rd] Samples of external code with various compilers?
In-Reply-To: <Pine.LNX.4.31.0212020753570.1625-100000@gannet.stats>
References: <qbfkuuc5r24t71k2kle2ecpufk597aa9e9@4ax.com> <Pine.LNX.4.31.0212020753570.1625-100000@gannet.stats>
Message-ID: <26qmuuob02b0sj5sb6iul9igaqavnpitlh@4ax.com>

On Mon, 2 Dec 2002 08:07:19 +0000 (GMT), you wrote in message
<Pine.LNX.4.31.0212020753570.1625-100000@gannet.stats>:

>I think there is information and lots of examples already for Fortran. 

I was thinking of two additions:

 1.  Rewriting the samples in sections 4.2 and/or 4.5 in Fortran,
Delphi, etc.  I might make them a little more elaborate, e.g. showing
how to return a character string.

 2.  Write up the details of how to do it in various specific
compilers.  For example, if you're using Microsoft Visual Fortran, how
do you create a DLL, how do you set the exported entry points, what
bugs do you need to work around.

>Base R has only interfaces for C and Fortran (and that via C-style
>linkage): SJava adds .Java.  So is the issue how to write in other
>languages to use a C interface?  `how to dyn.load functions' is easy: you
>just create an appropriate compiled object, a shared library, a DLL or (on
>MacOS X as I understand it) a module.  The issues seem to be to export the
>symbols correctly, and even more to import ones from R correctly.

Yes, that's the main issue.  There are also issues even with C:  if
you're using some compiler other than gcc, you probably won't compile
using R SHLIB, so what do you need to do?

Duncan



[Rd] Samples of external code with various compilers?
Duncan Murdoch