Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11125

Re: Function Interposition for C++ Operator new

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Function Interposition for C++ Operator new
Date 2011-10-28 19:37 +1300
Message-ID <9gv0u7F4kmU1@mid.individual.net> (permalink)
References <0b17afaa-7349-43d9-848b-cadcfae18888@m5g2000prg.googlegroups.com> <9gubfgFlttU1@mid.individual.net> <e93b8d2d-8a44-498c-b9c4-557973d43c1e@13g2000prp.googlegroups.com>

Show all headers | View raw


On 10/28/11 06:31 PM, Abhi wrote:
> On Oct 28, 5:31 am, Ian Collins<ian-n...@hotmail.com>  wrote:
>> On10/28/11 09:40 AM, Abhi wrote:
>>
>>> Recently only I was introduced to this very nice concept of Function
>>> Interposition in C. I tried googling it a bit further for C++, but
>>> could not find much info.
>>> Could someone please help me in applying the interposition concept to
>>> replace the calls for new and delete with my own calls.
>>
>> You don't have to resort to interposing for the new and delete
>> operators, just provide your own and the language will do the rest!
>
> Yes u r correct, overloading new and delete is one option, but that
> would
> call for recompiling. Interposition however will let me do the same
> without recompiling

You still have to compile something!

> Reading this, http://www.jayconrod.com/cgi/view_post.py?23
> will provide better understanding of the problem

As a long time Unix programmer, I am very familiar with function 
interposition.

The same rules apply to C++, but there in an extra layer of complexity 
in the form of name mangling.  In order to interpose a C++ function, you 
have to know it's mangled name.  That name will be compiler specific.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Function Interposition for C++ Operator new Abhi <meetabhi31@gmail.com> - 2011-10-27 13:40 -0700
  Re: Function Interposition for C++ Operator new Anand Hariharan <mailto.anand.hariharan@gmail.com> - 2011-10-27 14:35 -0700
  Re: Function Interposition for C++ Operator new Ian Collins <ian-news@hotmail.com> - 2011-10-28 13:31 +1300
    Re: Function Interposition for C++ Operator new Abhi <meetabhi31@gmail.com> - 2011-10-27 22:31 -0700
      Re: Function Interposition for C++ Operator new Ian Collins <ian-news@hotmail.com> - 2011-10-28 19:37 +1300
        Re: Function Interposition for C++ Operator new Marc <marc.glisse@gmail.com> - 2011-10-28 07:33 +0000
          Re: Function Interposition for C++ Operator new 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-28 04:19 -0700
            Re: Function Interposition for C++ Operator new 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-28 06:51 -0700
              Re: Function Interposition for C++ Operator new "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2011-10-28 16:53 +0200
          Re: Function Interposition for C++ Operator new Abhi <meetabhi31@gmail.com> - 2011-10-28 09:46 -0700

csiph-web