Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Release Version Of Code Library Pin
Chris Losinger27-Aug-02 6:12
professionalChris Losinger27-Aug-02 6:12 
GeneralRe: Release Version Of Code Library Pin
SchmoBoy27-Aug-02 6:17
SchmoBoy27-Aug-02 6:17 
GeneralRe: Release Version Of Code Library Pin
Tomasz Sowinski27-Aug-02 6:20
Tomasz Sowinski27-Aug-02 6:20 
GeneralRe: Release Version Of Code Library Pin
SchmoBoy27-Aug-02 6:25
SchmoBoy27-Aug-02 6:25 
GeneralRe: Release Version Of Code Library Pin
Tomasz Sowinski27-Aug-02 6:28
Tomasz Sowinski27-Aug-02 6:28 
GeneralRe: Release Version Of Code Library Pin
SchmoBoy27-Aug-02 6:31
SchmoBoy27-Aug-02 6:31 
GeneralRe: Release Version Of Code Library Pin
Tomasz Sowinski27-Aug-02 6:37
Tomasz Sowinski27-Aug-02 6:37 
GeneralRe: Release Version Of Code Library (SOLUTION FOUND!!!!!) Pin
SchmoBoy27-Aug-02 7:23
SchmoBoy27-Aug-02 7:23 
Well, Tomasz headed me in the right direction...

The solution is to overload the ::new and ::delete operators so ALL memory allocation and deallocation are routed through the DLL. In the base class I simply added the following functions. Note the three parameter new and delete are required as MFC uses these calls for tracing, etc. So I just included both to work with and without MFC/Win32.

<br />
void * CMPI_Obj::operator new(size_t sizeofRow)<br />
{<br />
    void* p = new char[sizeofRow];<br />
        <br />
    return memset(p, 0, sizeofRow * sizeof(char));<br />
} <br />
<br />
void * CMPI_Obj::operator new(size_t sizeofRow, LPCSTR lpszFileName, int nLine)<br />
{<br />
    void* p = new char[sizeofRow];<br />
        <br />
    return memset(p, 0, sizeofRow * sizeof(char));<br />
} <br />
<br />
void CMPI_Obj::operator delete(void *ptr)<br />
{<br />
    // any operation considered necessary, then:<br />
    ::delete ptr; <br />
}<br />
<br />
void CMPI_Obj::operator delete(void* ptr, LPCSTR lpszFileName, int nLine)<br />
{<br />
    // any operation considered necessary, then:<br />
    ::delete ptr; <br />
}<br />
<br />


Thanks for everyone's help and suggestions. I think I've found the most elegant solution where we can still JUST ship RELEASE and the customer can still build DEBUG against it.
GeneralRe: Release Version Of Code Library (SOLUTION FOUND!!!!!) Pin
Tomasz Sowinski27-Aug-02 8:05
Tomasz Sowinski27-Aug-02 8:05 
GeneralRe: Release Version Of Code Library (SOLUTION FOUND!!!!!) Pin
SchmoBoy27-Aug-02 8:21
SchmoBoy27-Aug-02 8:21 
GeneralRe: Release Version Of Code Library Pin
Chris Losinger27-Aug-02 6:25
professionalChris Losinger27-Aug-02 6:25 
GeneralRe: Release Version Of Code Library Pin
Daniel Turini27-Aug-02 6:25
Daniel Turini27-Aug-02 6:25 
GeneralRe: Release Version Of Code Library Pin
Chris Losinger27-Aug-02 6:26
professionalChris Losinger27-Aug-02 6:26 
GeneralRe: Release Version Of Code Library Pin
Jim Crafton27-Aug-02 6:26
Jim Crafton27-Aug-02 6:26 
GeneralLaunch a dialog box in a doc/view Pin
Anonymous27-Aug-02 5:14
Anonymous27-Aug-02 5:14 
GeneralRe: Launch a dialog box in a doc/view Pin
Tomasz Sowinski27-Aug-02 5:17
Tomasz Sowinski27-Aug-02 5:17 
GeneralRe: Launch a dialog box in a doc/view Pin
Rico62127-Aug-02 16:39
Rico62127-Aug-02 16:39 
GeneralRe: Launch a dialog box in a doc/view Pin
Tomasz Sowinski27-Aug-02 22:24
Tomasz Sowinski27-Aug-02 22:24 
GeneralInstallShield's CallDLLFx Pin
achandra00727-Aug-02 5:09
achandra00727-Aug-02 5:09 
GeneralRe: InstallShield's CallDLLFx Pin
Stephane Rodriguez.27-Aug-02 7:52
Stephane Rodriguez.27-Aug-02 7:52 
GeneralDid I Miss Something Here... Pin
Nick Parker27-Aug-02 4:44
protectorNick Parker27-Aug-02 4:44 
GeneralRe: Did I Miss Something Here... Pin
Chris Hambleton27-Aug-02 5:01
Chris Hambleton27-Aug-02 5:01 
GeneralRe: Did I Miss Something Here... Pin
Chris Losinger27-Aug-02 5:02
professionalChris Losinger27-Aug-02 5:02 
GeneralRe: Did I Miss Something Here... Pin
Nick Parker27-Aug-02 5:07
protectorNick Parker27-Aug-02 5:07 
GeneralRe: Did I Miss Something Here... Pin
Tomasz Sowinski27-Aug-02 5:00
Tomasz Sowinski27-Aug-02 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.