[Rd] Ralloc clash

Tom McCallum tom.mccallum at levelelimited.com
Thu Nov 23 14:15:40 CET 2006


Thank you that did the job.

Tom

On Thu, 23 Nov 2006 13:06:29 -0000, Prof Brian Ripley  
<ripley at stats.ox.ac.uk> wrote:

> On Thu, 23 Nov 2006, Prof Brian Ripley wrote:
>
>> Realloc is defined in R_ext/RS.h, and only if STRICT_R_HEADERS is not  
>> defined.  This *is* documented in 'Writing R Extensions'.
>
> That was the general intention, but seems not to cover this example.  
> Howver,
>
> #include <R.h>
> #undef Realloc
> #define R_Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n)  
> * sizeof(t)) )
> #include <windows.h>
>
> seems to work.
>
>
>> On Thu, 23 Nov 2006, Tom McCallum wrote:
>>
>>> 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:
>>>
>>>> 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
http://www.levelelimited.com
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