/* * Do the work that mainCRTStartup() would normally do */ void GetArgs(int *argc, char ***argv, char ***envp) { _startupinfo startinfo; /* * Set the app type to Console (check CRT/SRC/INTERNAL.H: * \#define _CONSOLE_APP 1) */ __set_app_type(1); /* Mark this module as an EXE file */ __onexitbegin = __onexitend = (_PVFV *)(-1); startinfo.newmode = _newmode; __getmainargs(argc, argv, envp, _dowildcard, &startinfo); __initenv = *envp; #ifdef _M_IX86 _adjust_fdiv = * _imp___adjust_fdiv; _setdefaultprecision(); #endif }
void _fpmath() { // // There is no need for 'finit' // since this is done by the OS // _cfltcvt_init(); #ifdef _M_IX86 #ifndef NT_BUILD _adjust_fdiv = _ms_p5_mp_test_fdiv(); #endif _setdefaultprecision(); _asm { fnclex } #endif return; }
static int __cdecl pre_c_init(void) { /* * Determine if this is a managed application */ managedapp = check_managed_app(); /* * Set __app_type properly */ #ifdef _WINMAIN_ __set_app_type(_GUI_APP); #else /* _WINMAIN_ */ __set_app_type(_CONSOLE_APP); #endif /* _WINMAIN_ */ /* * Mark this module as an EXE file so that atexit/_onexit * will do the right thing when called, including for C++ * d-tors. */ __onexitbegin = __onexitend = (_PVFV*)_encode_pointer((_PVFV*)(-1)); /* * Propogate the _fmode and _commode variables to the DLL */ *_IMP___FMODE = _fmode; *_IMP___COMMODE = _commode; #ifdef _M_IX86 /* * Set the local copy of the Pentium FDIV adjustment flag */ _adjust_fdiv = * _imp___adjust_fdiv; #endif /* _M_IX86 */ /* * Run the RTC initialization code for this DLL */ #ifdef _RTC _RTC_Initialize(); #endif /* _RTC */ /* * Call _setargv(), which will trigger a call to __setargv() if * SETARGV.OBJ is linked with the EXE. If SETARGV.OBJ is not * linked with the EXE, a dummy _setargv() will be called. */ #ifdef WPRFLAG _wsetargv(); #else /* WPRFLAG */ _setargv(); #endif /* WPRFLAG */ /* * If the user has supplied a _matherr routine then set * __pusermatherr to point to it. */ if (!__defaultmatherr) { __setusermatherr(_matherr); } #ifdef _M_IX86 _setdefaultprecision(); #endif /* _M_IX86 */ /* Enable per-thread locale if user asked for it */ if (__globallocalestatus == -1) { _configthreadlocale(-1); } return 0; }