home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 110
/
EnigmaAmiga110CD.iso
/
indispensabili
/
utility
/
apdf
/
xpdf-0.80
/
xpdf
/
stub.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1999-05-20
|
835b
|
55 lines
#ifdef __SASC
#include "gmem.h"
// operator new should not return NULL
void* operator new(size_t sz) {
return gmalloc(sz==0?1:sz);
}
void operator delete(void* p) {
gfree(p);
}
#endif
#ifdef __GNUC__
//#include <powerup/gcclib/powerup_protos.h>
typedef void (*fp)();
extern fp __CTOR_LIST__;
extern fp __DTOR_LIST__;
extern fp __END_CTOR_LIST__;
extern fp __END_DTOR_LIST__;
class stub_t {
public:
stub_t() {
//PPCprintf("ctors: %lx-%lx\n",&__CTOR_LIST__,&__END_CTOR_LIST__);
//PPCprintf("dtors: %lx-%lx\n",&__DTOR_LIST__,&__END_DTOR_LIST__);
fp* p=&__CTOR_LIST__;
while(*p++);
while(p<&__END_CTOR_LIST__) {
if(*p)
(*p)();
++p;
}
}
~stub_t() {
fp* p=&__DTOR_LIST__;
while(*p++);
while(p<&__END_DTOR_LIST__) {
if(*p)
(*p)();
++p;
}
}
};
static stub_t stub;
#endif