Beispiel #1
0
static int __cdecl
pre_c_init (void)
{
  managedapp = check_managed_app ();
  if (mingw_app_type)
    __set_app_type(_GUI_APP);
  else
    __set_app_type (_CONSOLE_APP);
  __onexitbegin = __onexitend = (_PVFV *) _encode_pointer ((_PVFV *)(-1));

  * __MINGW_IMP_SYMBOL(_fmode) = _fmode;
  * __MINGW_IMP_SYMBOL(_commode) = _commode;

#ifdef WPRFLAG
  _wsetargv();
#else
  _setargv();
#endif
  if (_MINGW_INSTALL_DEBUG_MATHERR)
    {
      if (! __defaultmatherr)
	{
	  __setusermatherr (_matherr);
	  __defaultmatherr = 1;
	}
    }

  if (__globallocalestatus == -1)
    {
    }
  return 0;
}
_CRTIMP int __cdecl __wgetmainargs (
        int *pargc,
        wchar_t ***pargv,
        wchar_t ***penvp,
        int dowildcard,
        _startupinfo * startinfo)
{
        int ret;

        /* set global new mode flag */
        _newmode = startinfo->newmode;

#if !defined(_CRT_APP) || defined(_KERNELX)
        if ( dowildcard )
            ret = __wsetargv(); /* do wildcard expansion after parsing args */
        else
#endif /* !defined(_CRT_APP) || defined(_KERNELX) */ 
            ret = _wsetargv();  /* NO wildcard expansion; just parse args */
        if (ret < 0)
#ifdef _SYSCRT
            ExitProcess(-1);      // Failed to parse the cmdline - bail
#else  /* _SYSCRT */
            return ret;
#endif  /* _SYSCRT */

        *pargc = __argc;
        *pargv = __wargv;

        /*
         * if wide environment does not already exist,
         * create it from multibyte environment
         */
#if !defined(_CRT_APP) || defined(_KERNELX)
        if (!_wenviron)
        {
            _wenvptr=__crtGetEnvironmentStringsW();

            if (_wsetenvp() < 0)
            {
                __mbtow_environ();
            }
        }

        *penvp = _wenviron;
#endif /* !defined(_CRT_APP) || defined(_KERNELX) */

        return ret;
}
Beispiel #3
0
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;
}