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