Re: [Rd] How to set R_CStackLimit

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 28 Jun 2007 21:32:12 +0100 (BST)

First, Rinterface.h is not installed on Windows, so you must be using a header from within the R sources. You do so at your own peril!

R_CStackLimit is only described in a Unix-specific section of 'Writing R Extensions'. The description there and Rinterface.h is designed for Unix compilers, not for Windows compilers. Since R_CStackLimit is a variable exported from a DLL, many Windows compilers will need it declared as a dllimport. You have not told us your compiler (but 'Rdll.lib' is not part of R and not needed for the recommended MinGW). If (as I guess) it is Visual Studio, you need to heed the comments in README.packages about this.

On Thu, 28 Jun 2007, Xiaoning wrote:

>
> Hi,
>
> I have tried to disable stack checking by set R_CStackLimit to -1. However,
> it always crashes my win32 multiple threads program. I am using R-2.5.0. My
> code looks like:
>
> #include <Rversion.h>
> #if (R_VERSION >= R_Version(2,3,0))
> #define R_INTERFACE_PTRS 1
> #define CSTACK_DEFNS 1
> #include <Rinterface.h>
> #endif
>
> and then, add below line to my main function:
> R_CStackLimit = (uintptr_t)-1; //crashes when step to this line.
>
> As for input library in link option, I only link to Rdll.lib. Am I missing
> something?
>
> Thanks very much!
>
> xzhang
>
>

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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 28 Jun 2007 - 21:20:37 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 Thu 28 Jun 2007 - 21:35:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.