Page 1 of 1
gcc new - delete functions
Posted: Mon Mar 29, 2004 12:00 am
by DruG5t0r3
How do you define the new and delete functions so that they point to your own asm code for example?
Thanks
RE:gcc new - delete functions
Posted: Mon Mar 29, 2004 12:00 am
by TheUbu
DruG5t0tr3,
With gcc use the flag -nobuiltin then link against your own libcpp library and define the functions here is some code example:
void * operator new[](unsigned size)
{
return malloc(size);
}
void operator delete[](void * ptr)
{
free(ptr);
return;
}
void * operator new(unsigned size)
{
return malloc(size);
}
void operator delete(void * ptr)
{
free(ptr);
return;
}
Hope that helps if you need further information just let me know.
-Christopher
RE:gcc new - delete functions
Posted: Mon Mar 29, 2004 12:00 am
by DruG5t0r3
Wow thank you, exactly what i needed
RE:gcc new - delete functions
Posted: Mon Mar 29, 2004 12:00 am
by TheUbu
No problem....
-Christopher