[Rd] Ralloc clash

Tom McCallum tom.mccallum at levelelimited.com
Thu Nov 23 11:48:09 CET 2006

Thank you for your reply.  My mistake - I meant Realloc (missed the 'e').   
This morning I reinstalled MinGW with all the patches suggested by the  
Install R on Windows Help page, including w32api-3.7, just to make sure  
all was as it should be.  I have put


at the top of my cpp file (which I did not know about so that was  
interesting) but it is still saying there is a conflict between Realloc in  
objidl.h and windows.h.  Interesting I had a C file which I _did_ manage  
to compile with the R.h and windows.h file in without this error coming  
up.  Could there be something going on with g++ that gcc is ignoring?  I  
am no sure it iss a clash now as I cannot find Realloc in the R includes  
but below is some output I have gathered which may be of assistance.

In objidl.h (line 532):
         STDMETHOD_(void*,Realloc)(THIS_ void*,ULONG) PURE;

In R.h it has the solitary line:
	/* for PROBLEM ... Calloc, Realloc, Free, Memcpy, F77_xxxx */
	Can only find a R_alloc but no Realloc.

======ERROR MSG OUTPUT==============
$ R CMD SHLIB callcdeclcall.cpp
making callcdeclcall.d from callcdeclcall.cpp
In file included from  
                  from callcdeclcall.cpp:4:
macro "Realloc" requires 3 arguments, but only 2 given
make: *** [callcdeclcall.d] Error 1
======END ERROR MSG OUTPUT==============

Headers in CPP file are:
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
#include <windows.h>
#include <cstdio>



On Wed, 22 Nov 2006 21:21:15 -0000, Prof Brian Ripley  
<ripley at stats.ox.ac.uk> wrote:

> Where exactly did you get windows.h from? The recommended source is  
> w32api-3.7.tar.gz, and there is no Ralloc in any of its header files,  
> including objidl.h.
> BTW, do you know about defining WIN32_LEAN_AND_MEAN when including  
> windows.h?  If not, it is worth finding out about.
> On Wed, 22 Nov 2006, Tom McCallum wrote:
>> Hi everyone,
>> Have been trying to include windows.h (from MinGW) and R.h into a  
>> package
>> and have found that Ralloc is coming up as a clash no matter which  
>> include
>> ordering I use.  In windows it has 2 arguments and is defined in  
>> objidl.h
>> and in R.h it is 3 arguments.  Any ideas of how to work round this?   
>> Have
>> checked the web and have not seen anyone else comment on this.

Dr. Thomas McCallum
Systems Architect,
Level E Limited
ETTC, The King's Buildings
Mayfield Road,
Edinburgh EH9 3JL, UK
Work  +44 (0) 131 472 4813
Fax:  +44 (0) 131 472 4719
Email: tom at levelelimited.com

Level E is a limited company incorporated in Scotland. The c...{{dropped}}

More information about the R-devel mailing list