< prev index next >

src/java.base/share/native/launcher/main.c

Print this page




  66 #pragma comment(linker,"/manifestdependency:\"type='win32' "            \
  67         "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
  68         "version='" _CRT_ASSEMBLY_VERSION "' "                          \
  69         "processorArchitecture='amd64' "                                \
  70         "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
  71 
  72 #endif  /* _M_AMD64 */
  73 #endif  /* _MSC_VER > 1400 && _MSC_VER < 1600 */
  74 #endif  /* _MSC_VER */
  75 
  76 /*
  77  * Entry point.
  78  */
  79 #ifdef JAVAW
  80 
  81 char **__initenv;
  82 
  83 int WINAPI
  84 WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
  85 {
  86     int margc, appclassc;
  87     char** margv;
  88     const jboolean const_javaw = JNI_TRUE;
  89 
  90     __initenv = _environ;
  91 
  92 #else /* JAVAW */
  93 int
  94 main(int argc, char **argv)
  95 {
  96     int margc, appclassc;
  97     char** margv;
  98     const jboolean const_javaw = JNI_FALSE;
  99 #endif /* JAVAW */
 100 
 101     JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile);
 102 
 103 #ifdef _WIN32
 104     {
 105         int i = 0;
 106         if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
 107             printf("Windows original main args:\n");
 108             for (i = 0 ; i < __argc ; i++) {
 109                 printf("wwwd_args[%d] = %s\n", i, __argv[i]);
 110             }
 111         }
 112     }
 113     JLI_CmdToArgs(GetCommandLine());
 114     margc = JLI_GetStdArgc();
 115     // add one more to mark the end
 116     margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));


 131             JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
 132             if (NULL == argsInFile) {
 133                 JLI_List_add(args, JLI_StringDup(argv[i]));
 134             } else {
 135                 int cnt, idx;
 136                 cnt = argsInFile->size;
 137                 for (idx = 0; idx < cnt; idx++) {
 138                     JLI_List_add(args, argsInFile->elements[idx]);
 139                 }
 140                 // Shallow free, we reuse the string to avoid copy
 141                 JLI_MemFree(argsInFile->elements);
 142                 JLI_MemFree(argsInFile);
 143             }
 144         }
 145         margc = args->size;
 146         // add the NULL pointer at argv[argc]
 147         JLI_List_add(args, NULL);
 148         margv = args->elements;
 149     }
 150 #endif /* WIN32 */
 151     if (const_appclasspath[0] == NULL) {
 152         appclassc = 0;
 153     } else {
 154         appclassc = sizeof(const_appclasspath) / sizeof(char *);
 155     }
 156     return JLI_Launch(margc, margv,
 157                    sizeof(const_jargs) / sizeof(char *), const_jargs,
 158                    appclassc, const_appclasspath,
 159                    VERSION_STRING,
 160                    DOT_VERSION,
 161                    (const_progname != NULL) ? const_progname : *margv,
 162                    (const_launcher != NULL) ? const_launcher : *margv,
 163                    HAS_JAVA_ARGS,
 164                    const_cpwildcard, const_javaw, const_ergo_class);
 165 }


  66 #pragma comment(linker,"/manifestdependency:\"type='win32' "            \
  67         "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
  68         "version='" _CRT_ASSEMBLY_VERSION "' "                          \
  69         "processorArchitecture='amd64' "                                \
  70         "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
  71 
  72 #endif  /* _M_AMD64 */
  73 #endif  /* _MSC_VER > 1400 && _MSC_VER < 1600 */
  74 #endif  /* _MSC_VER */
  75 
  76 /*
  77  * Entry point.
  78  */
  79 #ifdef JAVAW
  80 
  81 char **__initenv;
  82 
  83 int WINAPI
  84 WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
  85 {
  86     int margc;
  87     char** margv;
  88     const jboolean const_javaw = JNI_TRUE;
  89 
  90     __initenv = _environ;
  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 #endif /* JAVAW */
 100 
 101     JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile);
 102 
 103 #ifdef _WIN32
 104     {
 105         int i = 0;
 106         if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
 107             printf("Windows original main args:\n");
 108             for (i = 0 ; i < __argc ; i++) {
 109                 printf("wwwd_args[%d] = %s\n", i, __argv[i]);
 110             }
 111         }
 112     }
 113     JLI_CmdToArgs(GetCommandLine());
 114     margc = JLI_GetStdArgc();
 115     // add one more to mark the end
 116     margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));


 131             JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
 132             if (NULL == argsInFile) {
 133                 JLI_List_add(args, JLI_StringDup(argv[i]));
 134             } else {
 135                 int cnt, idx;
 136                 cnt = argsInFile->size;
 137                 for (idx = 0; idx < cnt; idx++) {
 138                     JLI_List_add(args, argsInFile->elements[idx]);
 139                 }
 140                 // Shallow free, we reuse the string to avoid copy
 141                 JLI_MemFree(argsInFile->elements);
 142                 JLI_MemFree(argsInFile);
 143             }
 144         }
 145         margc = args->size;
 146         // add the NULL pointer at argv[argc]
 147         JLI_List_add(args, NULL);
 148         margv = args->elements;
 149     }
 150 #endif /* WIN32 */





 151     return JLI_Launch(margc, margv,
 152                    sizeof(const_jargs) / sizeof(char *), const_jargs,
 153                    0, NULL,
 154                    VERSION_STRING,
 155                    DOT_VERSION,
 156                    (const_progname != NULL) ? const_progname : *margv,
 157                    (const_launcher != NULL) ? const_launcher : *margv,
 158                    HAS_JAVA_ARGS,
 159                    const_cpwildcard, const_javaw, const_ergo_class);
 160 }
< prev index next >