Path: chuka.playstation.co.uk!news From: "Graeme Evans" Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Re: C++ Date: Wed, 29 Apr 1998 21:00:10 +0100 Organization: Yaloozer Lines: 73 Message-ID: <6i80jo$lbr3@chuka.playstation.co.uk> References: <6i2t6e$n9k2@chuka.playstation.co.uk> <3544f37a.33823530@news.scea.sony.com> <6i5gsq$n9k3@chuka.playstation.co.uk> <6i5hmg$n9k6@chuka.playstation.co.uk> NNTP-Posting-Host: fourny.demon.co.uk X-Newsreader: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 right, now it works. I was thinking of some things i forgot to mention. You can supply your own new and delete (called __builtin_new and __builtin_delete). That way you can write debug versions and keep track of all your memory leaks, just like MFC. Ive tacked on some bodies I copied out of an old libgcc, but looking at it again they're a bit forgiving. Also, you might need to supply your own code for calling global constructors. this should do the trick; //define these outside of main() in the same file // __CTOR_LIST__ symbol created by linker typedef void (*func_ptr) (void); extern func_ptr __CTOR_LIST__[]; // put the next bit of code in main() after InitHeap but before everything else. unsigned int nptrs; nptrs=(unsigned int)__CTOR_LIST__[0]; if (nptrs==(unsigned int)-1) { // on others, it is -1 and you see how many // pointers there are because the array is // null terminated nptrs=0; while (__CTOR_LIST__[nptrs+1]!=NULL) { nptrs++; } } // Call the initialisation functions in reverse order (?) for (h=nptrs; h>=1; h--) { __CTOR_LIST__[h](); } You won't need this if you dont have any global constructors. Helpfully, if you give ld the flag --warn-constructors it'll tell you if you have some. Oh and remember to unzip the zip in the root directory. yours compilerly gr who would really really like to go to the ICA but lives in Edinburgh. grrr begin 666 newdel.cpp M+RH-"B J"6YE=V1E;"YC<' N( T*("H)#0H@*@EE>&%M<&QE(&]F(&9U;F-T M:6]NF4I.PT*=F]I9"!?7V)U M:6QT:6Y?=F5C7V1E;&5T92AV;VED("IP='(I.PT*=F]I9"!?7V)U:6QT:6Y? M9&5L971E*'9O:60@*G!TF4@/2 Q.PT*"7T-"@EP='(@/2 H=F]I9" J M*6UA;&QO8RAS:7IE*3L-"@EI9B H<'1R/3U.54Q,*0T*"7L-"@D)"7!R:6YT M9B@B;F5W(&9A:6QE9" M(&]U="!O9B!H96%P7&XB*3L-"@E]#0H)F4I#0I[#0H)PT*"5]?8G5I;'1I;E]D96QE -=&4H<'1R*3L-"GT-"@`` ` end