Example #1
0
    KLSTD_NOTHROW KLERR::ErrorPtr CreateError(
            const ErrLocAdapt*  pLocInfo,
		    const wchar_t*	    szwModule,
		    int				    nId,
		    const char*		    szaFile, 
		    int				    nLine,
		    const wchar_t*	    szwMessage) throw()
    {
        KLSTD::CAutoPtr<KLERR::Error> pResult;
	    try
        {
		    CError* p = NULL;        
            pResult.Attach(p = new CError);
            if(p)
            {
                p->Initialize(0, szwModule, nId, szaFile, nLine, szwMessage);
                if(pLocInfo)
                    p->LocSetInfo(*pLocInfo);
            };
        }
        catch(std::exception& err)
        {
            KLERR_TRACE_UNEXPECTED();
        };
	    if(!pResult)
		    pResult = KLERR::g_pNoMemoryError;
	    if(!pResult)
		    abort();
        return pResult;
    };
Example #2
0
	void InitModule()
	{
        g_pErrorCS = NULL;
        g_pModulesCS = NULL;        
        g_pModules = NULL;
        g_pLocModules = NULL;
        g_pLocDlls = NULL;
        g_pNoMemoryError = NULL;
        ;
		::KLSTD_CreateCriticalSection(&g_pModulesCS);
        g_pErrorCS = g_pModulesCS;
        ;
        g_pModules = new modules_t(c_nModulesHashSize);
        g_pLocModules = new modules_t(c_nModulesHashSize);
        g_pLocDlls = new map_locmodules_t(c_nModulesHashSize);
        ;
        {
            KLSTD::CAutoPtr<Error> pError;
            CError* p = NULL;
            pError.Attach(p = new RcClassImpl<CError>);
            if(p)
            {
                p->Initialize(
                            0, 
                            L"KLSTD", 
                            STDE_NOMEMORY, 
                            NULL, 
                            0, 
                            L"Out Of memory", 
                            true);
		        g_pNoMemoryError = pError;
            };
        };
	};