Figure 2   Using the /GZ Switch

// Compiler switches used: /c /Od /FA [± /GZ]

int MyFn(int j) {
    int m = 0;
//  Line 2: Variable initialization.
//    push    ebp
//    mov    ebp, esp
//    push    ecx
// -> mov    DWORD PTR [ebp-4], -858993460        ; ccccccccH    

m += 1;
    return m;

// No need to check the stack at the end of this function because no other 
// functions are called.
}


int main () {
    int j;

// Line 14:  Variable initialization.
//    push    ebp
//    mov    ebp, esp
//    push    ecx
// -> push    esi
// -> mov    DWORD PTR [ebp-4], -858993460        ; ccccccccH

// Line 18: Save the stack pointer in preparation for the call to the function 
// pointer.
// -> mov    esi, esp
    j = MyFn(j);
// Check the stack upon return from the call into the function pointer.
// -> cmp    esi, esp
// -> call    __chkesp

// Line 22: Check the stack at the end of the function.
// -> pop    esi
// -> add    esp, 4
// -> cmp    ebp, esp
// -> call    __chkesp

    return j;
}

Figure 3   Release Build Sizes

Visual C++ 5.0 /OPT:WIN98 /OPT:NOWIN98
35,328 45,056 34,816
1,945,600 1,949,696 1,941,504


Figure 4   DELAYLOAD Code

// MyDll.h
int DECLSPEC MyDllFn(char *str);


// MyClient.cpp
#include "stdafx.h"    
#include <iostream>
#include <windows.h>

#define DECLSPEC __declspec(dllimport)
#include "mydll\mydll.h"

#include <delayimp.h>

using namespace std;

#define DLL_LOAD_ERROR    -1

int main(int argc, char* argv[])
{
    char *str = "hello";
    int i=0;

    // Make sure to trap for failed function/dll loads.
    // A filed load cause a crash.
    __try
        {
        i = MyDllFn(str);
        }
    __except(1)
        {
        i = DLL_LOAD_ERROR;
        cout << "Could not find MyDll" << endl;
    }

    if (i != DLL_LOAD_ERROR)
    {
        cout << "MyDll successfully loaded" << endl;
        cout << "i equals " << i << endl;
    
        if (__FUnloadDelayLoadedDLL("MyDll.dll") == TRUE)
            cout << "MyDll was successfully unloaded" << endl;            
        else
            cout << "Unable to unload MyDll" << endl;
    }
    return i;
}

Figure 8   ObjModel Methods

Method Description
Application.AddProject Creates a new project and adds it to the workspace.
Application.Clean Cleans a specified configuration by deleting all intermediate and output files generated by the configuration.
BuildProject.AddFile Adds a file to the project.
BuildProject.AddConfiguration Adds a configuration to the project.
Configuration.AddCustomBuildStepToFile Adds a custom build step to a specified file.
Configuration.AddFileSettings Changes the settings of a specified file.
Configuration.MakeCurrentSettingsDefault Changes the default settings for this configuration to the values of the current settings.
Configuration.RemoveFileSettings Removes the settings of a specified file.
Property Description
Application.Errors Gets the number of errors that occurred during the last build.
Application.Warnings Gets the number of warnings that occurred during the last build.
Configuration.Configurations Gets the configurations of dependent projects.


Figure 10   New Formatting Symbols

Symbol Display
,hr HRESULTS and Win32 error codes.
,st Unicode and ANSI strings. Can display CStrings.
,mq Quad words, ala mb, mw and md.
,wm Windows messages like WM_COMMAND or WM_CLOSE.
,wc Windows constants like the values defined in WINNLS.H. Some examples are WC_DEFAULTCHAR and C1_UPPER.


Figure 14   Sample Add-ins

Add-in Description
API2Help Creates HTML or WinHelp documentation for a function prototype
BldRec Records build times sequentially into a text file
BookNote Makes persistent book marks
BrkPntMgr Lists and controls breakpoints
CmdWnd Issues an IDE command in a command window
Pipe Filter or pipe output from the text editor
ReplAll Across open files search and replace