Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/bin/main.c
38767 views
/*1* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526/*27* This file contains the main entry point into the launcher code28* this is the only file which will be repeatedly compiled by other29* tools. The rest of the files will be linked in.30*/3132#include "defines.h"3334#ifdef _MSC_VER35#if _MSC_VER > 1400 && _MSC_VER < 16003637/*38* When building for Microsoft Windows, main has a dependency on msvcr??.dll.39*40* When using Visual Studio 2005 or 2008, that must be recorded in41* the [java,javaw].exe.manifest file.42*43* As of VS2010 (ver=1600), the runtimes again no longer need manifests.44*45* Reference:46* C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h47*/48#include <crtassem.h>49#ifdef _M_IX865051#pragma comment(linker,"/manifestdependency:\"type='win32' " \52"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \53"version='" _CRT_ASSEMBLY_VERSION "' " \54"processorArchitecture='x86' " \55"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")5657#endif /* _M_IX86 */5859//This may not be necessary yet for the Windows 64-bit build, but it60//will be when that build environment is updated. Need to test to see61//if it is harmless:62#ifdef _M_AMD646364#pragma comment(linker,"/manifestdependency:\"type='win32' " \65"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \66"version='" _CRT_ASSEMBLY_VERSION "' " \67"processorArchitecture='amd64' " \68"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")6970#endif /* _M_AMD64 */71#endif /* _MSC_VER > 1400 && _MSC_VER < 1600 */72#endif /* _MSC_VER */7374/*75* Entry point.76*/77#ifdef JAVAW7879char **__initenv;8081int WINAPI82WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)83{84int margc;85char** margv;86const jboolean const_javaw = JNI_TRUE;8788__initenv = _environ;8990#else /* JAVAW */91int92main(int argc, char **argv)93{94int margc;95char** margv;96const jboolean const_javaw = JNI_FALSE;97#endif /* JAVAW */98#ifdef _WIN3299{100int i = 0;101if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {102printf("Windows original main args:\n");103for (i = 0 ; i < __argc ; i++) {104printf("wwwd_args[%d] = %s\n", i, __argv[i]);105}106}107}108JLI_CmdToArgs(GetCommandLine());109margc = JLI_GetStdArgc();110// add one more to mark the end111margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));112{113int i = 0;114StdArg *stdargs = JLI_GetStdArgs();115for (i = 0 ; i < margc ; i++) {116margv[i] = stdargs[i].arg;117}118margv[i] = NULL;119}120#else /* *NIXES */121margc = argc;122margv = argv;123#endif /* WIN32 */124return JLI_Launch(margc, margv,125sizeof(const_jargs) / sizeof(char *), const_jargs,126sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,127FULL_VERSION,128DOT_VERSION,129(const_progname != NULL) ? const_progname : *margv,130(const_launcher != NULL) ? const_launcher : *margv,131(const_jargs != NULL) ? JNI_TRUE : JNI_FALSE,132const_cpwildcard, const_javaw, const_ergo_class);133}134135136