Re: [Rd] Call C code from R

From: Prof Brian Ripley <>
Date: Mon, 17 Sep 2007 08:08:25 +0100 (BST)

On Mon, 17 Sep 2007, ????? ?. ??????? wrote:

> Hello, All!
> I'm new for R-devel list. And I'd like to ask some questions,
> maybe they will be stuped for the most part of members of the
> list.
> I need to call function which is written in C++ from R.

Your subject line says C ....

> My questions are:
> 1. How should I include libraries (for example, iomanip,
> sstream, iostream)?
> 2. Can I use namespace?

What you link into R is a shared object aka DLL. If you use the documented ways (e.g. R CMD CHLIB) to make this, it will be linked against the platform's standard C++ libraries. There are lots of examples of C++ code in CRAN packages doing this.

The use of iostream is discussed in 'Writing R Extensions'.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Mon 17 Sep 2007 - 07:18:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Sep 2007 - 12:41:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.