Skip to content
Prev 22987 / 63421 Next

Ralloc clash

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

#define WIN32_LEAN_AND_MEAN

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  
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/objbase.h:73,
                  from  
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ole2.h:9,
                  from  
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:111,
                  from callcdeclcall.cpp:4:
c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/objidl.h:532:45:  
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>

Thanks,

Tom


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