From ripley at stats.ox.ac.uk  Tue Nov 23 13:23:44 2010
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 23 Nov 2010 12:23:44 +0000 (GMT)
Subject: [Rd] How to call R from C
In-Reply-To: <1290500209023-3054977.post@n4.nabble.com>
References: <dd613833191d1a0251af9399334f3f51@tweb20-2.nm>
	<962040c341597fd9c2edf38455726b66@braverock.com>
	<1290500209023-3054977.post@n4.nabble.com>
Message-ID: <alpine.LFD.2.00.1011231220310.23289@toucan.stats.ox.ac.uk>

On Tue, 23 Nov 2010, Wonjae Lee wrote:

>
> Thank you!
>
> I tried to build a C code below, and I got a error message.

How?: you have not shown us the commands you used.

At a guess you are
on Windows and didn't tell us (see the posting quide)
using MSVC (not supported but may work -- just don't ask us for help)
not linking against R.dll.

There are examples in the tests/Embedding directory of the R sources 
-- and they do work on Windows.

> Thank you for your help in advance.
>
> <C code>
>
> #include "embeddedRCall.h"
>
> int main(int argc, char *argv[])
> {
>    eval_R_command("print", argc, argv);
>    return(0);
> }
> =========================================
>
> <error message>
> --------------------Configuration: Rtest - Win32 Debug--------------------
> Compiling...
> Rtest.c
> Linking...
> Rtest.obj : error LNK2001: unresolved external symbol _eval_R_command
> Debug/Rtest.exe : fatal error LNK1120: 1 unresolved externals
> Error executing link.exe.
>
> Rtest.exe - 2 error(s), 0 warning(s)
>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/How-to-call-R-from-C-tp3053943p3054977.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] How to call R from C
Prof Brian Ripley