From sdavis2 at mail.nih.gov  Mon Jan  9 21:27:28 2006
From: sdavis2 at mail.nih.gov (Sean Davis)
Date: Mon, 09 Jan 2006 15:27:28 -0500
Subject: [Rd] Interfacing R and C++
In-Reply-To: <Pine.LNX.4.61.0601092016380.21148@gannet.stats>
Message-ID: <BFE83160.3551%sdavis2@mail.nih.gov>




On 1/9/06 3:20 PM, "Prof Brian Ripley" <ripley at stats.ox.ac.uk> wrote:

> The wrapper function must be in extern "C" {} since you want to give it a
> C name (and not a mangled C++ one).  These days, the headers probably do
> not need to be, but in theory if they are C headers they should be in any
> C++ code.
> 
> I think R-exts is quite clear on this:
> 
>    To use with @R{}, the only thing we have to do is writing a wrapper
>    function and ensuring that the function is enclosed in
>                               ^^^^^^^^^^^^^^^^^^^^^^^^

Yes, the documentation is clear, provided one knows what name-mangling is
and why it is important, which I now understand better.

Thanks,
Sean



[Rd] Interfacing R and C++
Sean Davis