0N/A/*
5270N/A * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A
0N/A/*
0N/A * This file contains the main entry point into the launcher code
0N/A * this is the only file which will be repeatedly compiled by other
0N/A * tools. The rest of the files will be linked in.
0N/A */
0N/A
0N/A#include "defines.h"
0N/A
795N/A#ifdef _MSC_VER
2324N/A#if _MSC_VER > 1400 && _MSC_VER < 1600
795N/A
795N/A/*
795N/A * When building for Microsoft Windows, main has a dependency on msvcr??.dll.
795N/A *
2324N/A * When using Visual Studio 2005 or 2008, that must be recorded in
795N/A * the [java,javaw].exe.manifest file.
795N/A *
2324N/A * As of VS2010 (ver=1600), the runtimes again no longer need manifests.
2324N/A *
795N/A * Reference:
795N/A * C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
795N/A */
795N/A#include <crtassem.h>
795N/A#ifdef _M_IX86
795N/A
795N/A#pragma comment(linker,"/manifestdependency:\"type='win32' " \
795N/A "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
795N/A "version='" _CRT_ASSEMBLY_VERSION "' " \
795N/A "processorArchitecture='x86' " \
795N/A "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
795N/A
795N/A#endif /* _M_IX86 */
795N/A
795N/A//This may not be necessary yet for the Windows 64-bit build, but it
795N/A//will be when that build environment is updated. Need to test to see
795N/A//if it is harmless:
795N/A#ifdef _M_AMD64
795N/A
795N/A#pragma comment(linker,"/manifestdependency:\"type='win32' " \
795N/A "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
795N/A "version='" _CRT_ASSEMBLY_VERSION "' " \
795N/A "processorArchitecture='amd64' " \
795N/A "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
795N/A
795N/A#endif /* _M_AMD64 */
2324N/A#endif /* _MSC_VER > 1400 && _MSC_VER < 1600 */
795N/A#endif /* _MSC_VER */
0N/A
0N/A/*
0N/A * Entry point.
0N/A */
0N/A#ifdef JAVAW
0N/A
0N/Achar **__initenv;
0N/A
0N/Aint WINAPI
0N/AWinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
0N/A{
0N/A int margc;
0N/A char** margv;
0N/A const jboolean const_javaw = JNI_TRUE;
0N/A
0N/A __initenv = _environ;
0N/A
0N/A#else /* JAVAW */
0N/Aint
5270N/Amain(int argc, char **argv)
0N/A{
0N/A int margc;
0N/A char** margv;
0N/A const jboolean const_javaw = JNI_FALSE;
5270N/A#endif /* JAVAW */
5270N/A#ifdef _WIN32
5270N/A {
5270N/A int i = 0;
5270N/A if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
5270N/A printf("Windows original main args:\n");
5270N/A for (i = 0 ; i < __argc ; i++) {
5270N/A printf("wwwd_args[%d] = %s\n", i, __argv[i]);
5270N/A }
5270N/A }
5270N/A }
5270N/A JLI_CmdToArgs(GetCommandLine());
5270N/A margc = JLI_GetStdArgc();
5270N/A // add one more to mark the end
5270N/A margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));
5270N/A {
5270N/A int i = 0;
5270N/A StdArg *stdargs = JLI_GetStdArgs();
5270N/A for (i = 0 ; i < margc ; i++) {
5270N/A margv[i] = stdargs[i].arg;
5270N/A }
5270N/A margv[i] = NULL;
5270N/A }
5270N/A#else /* *NIXES */
0N/A margc = argc;
0N/A margv = argv;
5270N/A#endif /* WIN32 */
0N/A return JLI_Launch(margc, margv,
0N/A sizeof(const_jargs) / sizeof(char *), const_jargs,
0N/A sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
0N/A FULL_VERSION,
0N/A DOT_VERSION,
0N/A (const_progname != NULL) ? const_progname : *margv,
0N/A (const_launcher != NULL) ? const_launcher : *margv,
0N/A (const_jargs != NULL) ? JNI_TRUE : JNI_FALSE,
0N/A const_cpwildcard, const_javaw, const_ergo_class);
0N/A}