JA> I suposse that the best approach to acomplish this is overloading the
JA> operators new and delete. But I have a problem here: I cannot call the
JA> "global" default new from inside my overloaded new, even using the scope
JA> (::) operator; every attempt to call the original new results in a
JA> annoying
JA> recursive call to may own overloaded new, so I can't actually allocate
JA> memory using this approach. On the other hand, if I use malloc, the
JA> program
JA> crashes. I am using DJGPP 2.1 (GCC 2.7.0, I think).
i don't know about DJGPP, but with my compiler, there is a file
that includes the declarations for modifying the global default new.
you could hook that thing: keep the old funcptr; check the sizeof of
your object and then pass control to the old func.
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)
|