[R] Rf_initEmbeddedR in Windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 23 08:54:20 CEST 2005


How to generate an import library for R.dll for Visual Studio is discussed 
in README.packages: please do read it.

Do note the recommendation not to install R in a path with spaces - your 
tool is one of many that does not work with spaces.  But you don't want a 
Borland import library (any more than the MinGW import library which we 
do provide).

Note too the posting guide, and use the appropriate list.  This is not an 
appropriate question for R-help (it is not even a question about R, but 
about an unsupported compiler system).

On Thu, 22 Sep 2005 yuting at iastate.edu wrote:

> Hi All
>
> My C++/linux program uses Rf_initEmbeddedR to start R and then calls some
> R functions. Now I try to port it to Windows. Give the fact that
> Rf_initEmbeddedR is missing in Windows, I try to use the implmentation in
> Rserve by Simon Urbanek. When I build in MS Visual Studio, I get the
> following linking error
>
> error LNK2019: unresolved external symbol __imp__putenv referenced in
> function _Rf_initEmbeddedR
> error LNK2019: unresolved external symbol __imp__UserBreak referenced in
> function _my_onintr
> error LNK2019: unresolved external symbol _getDLLVersion referenced in
> function _Rf_initEmbeddedR
> error LNK2019: unresolved external symbol _R_DefParams referenced in
> function _Rf_initEmbeddedR
> error LNK2019: unresolved external symbol _R_SetParams referenced in
> function _Rf_initEmbeddedR
> error LNK2019: unresolved external symbol _R_SizeFromEnv referenced in
> function _Rf_initEmbeddedR
> error LNK2019: unresolved external symbol _setup_Rmainloop referenced in
> function _Rf_initEmbeddedR
> error LNK2019: unresolved external symbol _setup_term_ui referenced in
> function _Rf_initEmbeddedR
>
> I think the error come from the following declaration of functions calling
> into R.dll and the missing of R.lib corresponding to R.dll.
> extern char	*getDLLVersion();
> extern void	R_DefParams(Rstart);
> extern void  R_SetParams(Rstart);
> extern void  setup_term_ui(void);
> extern void  ProcessEvents(void);
> extern void  end_Rmainloop(void), R_ReplDLLinit(void);
> extern int  R_ReplDLLdo1();
> extern void  run_Rmainloop(void);
>
> Then I google it, I find some solution of Borland C++ Builder, i.e. using
> implib to generate R.lib. The only place where  I can find implib is at
> (http://www.geocities.com/SiliconValley/5806/download.htm#IMPLIB) and the
> commond generates a error as below
> C:\Program Files\R\rw2011\bin>IMPLIB32.EXE R.dll
> ImpLib32 Version 1.02 - ImpLib for Win32
> Copyright (c) 1996-97 by Markus Seger (mseger at kagi.com)
> Creating R.lib...
> 'c:\Program' is not recognized as an internal or external command,
> operable program or batch file.
> 'c:\Program' is not recognized as an internal or external command,
> operable program or batch file.
>
> My questios are
> 1) Is it a right way to generate R.lib to remove the linking error.
> 2) If yes, how can I generate the R.lib valid for MS Visual Studio
> 3) If not, how can I call the functions directly in R.dll


-- 
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




More information about the R-help mailing list