Skip to content

Instantly share code, notes, and snippets.

@myzone
Created October 7, 2014 14:21
Show Gist options
  • Save myzone/fb40b6f9809688c8b82f to your computer and use it in GitHub Desktop.
Save myzone/fb40b6f9809688c8b82f to your computer and use it in GitHub Desktop.
#ifndef _CPLUSPLUS_H
#define _CPLUSPLUS_H
/*
This is applicable if using virtual inheritance.
*/
__extension__ typedef int __guard __attribute__((mode (__DI__)));
extern "C" int __cxa_guard_acquire(__guard *);
extern "C" void __cxa_guard_release (__guard *);
extern "C" void __cxa_guard_abort (__guard *);
int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);};
void __cxa_guard_release (__guard *g) {*(char *)g = 1;};
void __cxa_guard_abort (__guard *) {};
/*
This is applicable if using pure virtual inheritance.
*/
extern "C" void __cxa_pure_virtual(void);
void __cxa_pure_virtual(void) {};
/*
Operators required for C++
*/
void* operator new(size_t size);
void operator delete(void* size);
void * operator new(size_t size)
{
return malloc(size);
}
void operator delete(void* ptr)
{
free(ptr);
}
#endif //_CPLUSPLUS_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment