jdk/src/share/bin/main.c
author tbell
Wed, 14 Jan 2009 21:35:03 -0800
changeset 1776 33e9405ab91b
parent 715 f16baef3a20e
child 5381 d6d64a42ff51
permissions -rw-r--r--
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll 6779412: VS2008 errors compiling jdk sources Summary: Update Makefiles to tolerate newer Visual Studio releases and runtimes. Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 39
diff changeset
     2
 * Copyright 1995-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * This file contains the main entry point into the launcher code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * this is the only file which will be repeatedly compiled by other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * tools. The rest of the files will be linked in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "defines.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
1776
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    35
#ifdef _MSC_VER
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    36
#if _MSC_VER > 1400
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    37
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    38
/*
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    39
 * When building for Microsoft Windows, main has a dependency on msvcr??.dll.
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    40
 *
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    41
 * When using Visual Studio 2005 or later, that must be recorded in
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    42
 * the [java,javaw].exe.manifest file.
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    43
 *
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    44
 * Reference:
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    45
 *     C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    46
 */
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    47
#include <crtassem.h>
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    48
#ifdef _M_IX86
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    49
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    50
#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    51
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    52
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    53
        "processorArchitecture='x86' "                                  \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    54
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    55
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    56
#endif /* _M_IX86 */
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    57
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    58
//This may not be necessary yet for the Windows 64-bit build, but it
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    59
//will be when that build environment is updated.  Need to test to see
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    60
//if it is harmless:
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    61
#ifdef _M_AMD64
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    62
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    63
#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    64
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    65
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    66
        "processorArchitecture='amd64' "                                \
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    67
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    68
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    69
#endif  /* _M_AMD64 */
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    70
#endif  /* _MSC_VER > 1400 */
33e9405ab91b 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents: 715
diff changeset
    71
#endif  /* _MSC_VER */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * Entry point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
#ifdef JAVAW
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
char **__initenv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
int WINAPI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    int margc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    char** margv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    const jboolean const_javaw = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    __initenv = _environ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    margc = __argc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    margv = __argv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
#else /* JAVAW */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
main(int argc, char ** argv)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    int margc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    char** margv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    const jboolean const_javaw = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    margc = argc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    margv = argv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
#endif /* JAVAW */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    return JLI_Launch(margc, margv,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                   sizeof(const_jargs) / sizeof(char *), const_jargs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                   sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                   FULL_VERSION,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                   DOT_VERSION,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                   (const_progname != NULL) ? const_progname : *margv,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                   (const_launcher != NULL) ? const_launcher : *margv,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                   (const_jargs != NULL) ? JNI_TRUE : JNI_FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                   const_cpwildcard, const_javaw, const_ergo_class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
}