Back to index

lightning-sunbird  0.9+nobinonly
apitest.cpp File Reference
#include <stdio.h>
#include <crtdbg.h>
#include "nsEmbedAPI.h"

Go to the source code of this file.


int main (int argc, char *argv[])

Function Documentation

int main ( int  argc,
char *  argv[] 

Definition at line 37 of file apitest.cpp.

    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );

    _CrtMemState sBefore, sMiddle, sAfter;

    // Store a memory checkpoint in the s1 memory-state structure

       char *pszBinDirPath = nsnull;
       if (argc > 1)
              pszBinDirPath = argv[1];
       printf("apitest running...\n");
       nsCOMPtr<nsILocalFile> binDir;
       NS_NewLocalFile(pszBinDirPath, PR_TRUE, getter_AddRefs(binDir));
       nsresult rv = NS_InitEmbedding(binDir, nsnull);
       if (NS_FAILED(rv))
              printf("NS_InitEmbedding FAILED (rv = 0x%08x)\n", rv);
              // DROP THROUGH - NS_TermEmbedding should cope
        printf("NS_InitEmbedding SUCCEEDED (rv = 0x%08x)\n", rv);

       // TODO put lot's of interesting diagnostic stuff here such as time taken
       //      to initialise
    // Memory used up etc.

       rv = NS_TermEmbedding();
       if (NS_FAILED(rv))
              printf("NS_TermEmbedding FAILED (rv = 0x%08x)\n", rv);
              // DROP THROUGH
        printf("NS_TermEmbedding SUCCEEDED (rv = 0x%08x)\n", rv);

       // TODO more interesting stuff. Time to shutdown

    // Dump the leaked memory
    printf("FINAL LEAKAGE:\n");
     _CrtMemState sDifference;
    if ( _CrtMemDifference(&sDifference, &sBefore, &sAfter))

    _CrtDumpMemoryLeaks( );

    printf("apitest complete\n");

       return 0;

Here is the call graph for this function: