How do you define the new and delete functions so that they point to your own asm code for example?
Thanks
gcc new - delete functions
RE:gcc new - delete functions
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
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