c/c++啟動函數startup

來源:互聯網
上載者:User

標籤:cpp

__declspec(noinline)int__tmainCRTStartup(         void         ){        int initret;        int mainret=0;        int managedapp;#ifdef _WINMAIN_        _TUCHAR *lpszCommandLine;        STARTUPINFOW StartupInfo;        GetStartupInfoW( &StartupInfo );#endif  /* _WINMAIN_ */#ifdef _M_IX86        /*         * Enable app termination when heap corruption is detected on         * Windows Vista and above. This is a no-op on down-level OS's         * and enabled by default for 64-bit processes.         */        if (!_NoHeapEnableTerminationOnCorruption)        {            HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);        }#endif  /* _M_IX86 */        /*         * Determine if this is a managed application         */        managedapp = check_managed_app();        if ( !_heap_init() )                /* initialize heap */            fast_error_exit(_RT_HEAPINIT);  /* write message and die */        if( !_mtinit() )                    /* initialize multi-thread */            fast_error_exit(_RT_THREAD);    /* write message and die */        /* Enable buffer count checking if linking against static lib */        _CrtSetCheckCount(TRUE);        /*         * Initialize the Runtime Checks stuff         */#ifdef _RTC        _RTC_Initialize();#endif  /* _RTC */        /*         * Guard the remainder of the initialization code and the call         * to user's main, or WinMain, function in a __try/__except         * statement.         */        __try {            if ( _ioinit() < 0 )            /* initialize lowio */                _amsg_exit(_RT_LOWIOINIT);            /* get wide cmd line info */            _tcmdln = (_TSCHAR *)GetCommandLineT();            /* get wide environ info */            _tenvptr = (_TSCHAR *)GetEnvironmentStringsT();            if ( _tsetargv() < 0 )                _amsg_exit(_RT_SPACEARG);            if ( _tsetenvp() < 0 )                _amsg_exit(_RT_SPACEENV);            initret = _cinit(TRUE);                  /* do C data initialize */            if (initret != 0)                _amsg_exit(initret);#ifdef _WINMAIN_            lpszCommandLine = _twincmdln();            mainret = _tWinMain( (HINSTANCE)&__ImageBase,         WinMain函數                                 NULL,                                 lpszCommandLine,                                 StartupInfo.dwFlags & STARTF_USESHOWWINDOW                                      ? StartupInfo.wShowWindow                                      : SW_SHOWDEFAULT                                );#else  /* _WINMAIN_ */            _tinitenv = _tenviron;            mainret = _tmain(__argc, _targv, _tenviron);   此處才是真正的main函數#endif  /* _WINMAIN_ */            if ( !managedapp )                exit(mainret);                             執行完後調用exit函數            _cexit();                                      做善後處理        }        __except ( _XcptFilter(GetExceptionCode(), GetExceptionInformation()) )        {            /*             * Should never reach here             */            mainret = GetExceptionCode();            if ( !managedapp )                _exit(mainret);            _c_exit();        } /* end of try - except */        return mainret;}

c/c++啟動函數startup

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.