I don''t see anything wrong, except that since your using C++ you should be using new and not malloc().
I threw this in a newly created VC++ 6.0 Win32 Application created as a typical Hello, World! program. It worked and executed in both debug and release.
// just below #define MAX_LOADSTRINGclass PALETTE{ public: BYTE mA; BYTE mB; BYTE mC;};class HEADER{ public: WORD mD; DWORD mE; DWORD mF; WORD mG; WORD mH; WORD mI; PALETTE mJ; UCHAR *mK;};class IMAGE { public: HEADER *ptr; public: int load(void); int load2(void);};// globals sectionIMAGE i1, i2;// first action in WinMain()i1.load();i2.load2();// at bottomint IMAGE::load(void){ ptr = new HEADER; return(0);}int IMAGE::load2(void){ ptr = (HEADER*) malloc(sizeof(HEADER)); return(0);}
Its not exactly the same, but similar. Maybe a bit more C++ like (drop load2() though
).
Maybe its not your code, but your build settings. Good luck.
Mike Roberts
aka milo
mlbobs@telocity.com