[cfe-dev] How to override new operator in modules

Richard Smith richard at metafoo.co.uk
Wed Mar 4 14:16:48 PST 2015


On Wed, Mar 4, 2015 at 12:08 PM, Thompson, John <
John_Thompson at playstation.sony.com> wrote:

>  Sorry, I didn’t mention that when I try to build the library with the
> overridden new and delete operators, I get the following compile error:
>
>
>
> 5>  In file included from
> D:\Sony\wws_shared\sdk\trunk\components\wws_mem\example\debugging\debugging.cpp:18:
>
> 5>  In file included from ..\..\..\wws_mem/wws_mem_all.h:173:
>
> 5>..\..\..\wws_mem/wws_mem_new.h(149,16): error : redefinition of
> 'operator new'
>
> 5>  D:\usr\local\psp2\ORBIS SDKs\2.500_pre_mod\target\include\new(123,14)
> :  note: previous definition is here
>
>
>
> The new function signatures are effectively the same.
>
>
>
> Is this the effective end of overriding global  new and delete?
>

Why do you have a definition of 'operator new' in either of these places? A
replacement global 'operator new' cannot be defined as 'inline', so it
should never be defined in a header file, and certainly not in a header
that you put into a module.


> Thanks.
>
>
>
> -John
>
>
>
> *From:* Thompson, John
> *Sent:* Wednesday, March 04, 2015 12:00 PM
> *To:* cfe-dev at cs.uiuc.edu
> *Subject:* How to override new operator in modules
>
>
>
> How do you override global new and delete operators when they are also
> defined in the “new” standard header included in modules?
>
>
>
> I’m trying to build a memory allocator library against a set of PS4
> headers that have been modularized.  The memory library overrides new and
> delete.  In the PS4 headers the “new” header is included in the standard
> headers.
>
>
>
> Thanks.
>
>
>
> -John
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150304/2a9187fb/attachment.html>


More information about the cfe-dev mailing list