Subj : Re: not a valid Win32 application... To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Wed Nov 05 2003 10:25 pm The linker command is the problem. The type of file to create is not specified, an option setting for GUI mode is used but the program is console mode and all of the startup code, Windows import library and the runtime library are missing. I assume that the linker and compiler command lines are not indented as an artifact of the news reader. If not then indent them. Try this instead: ilink32 /Tpe/ap/c/x/Gn c0x32 batchuser,batchuser,,$(BATCH) import32 cw32 /Tpe create an EXE /ap console mode /c case sensitive linking /x no map file /Gn no state files c0x32.obj startup code import32.lib Windows import library cw32.lib runtime library The startup code should be the first object file listed. The runtime library should be the last library file listed However the following will give you a smaller executable and nothing that a C program uses is deleted. ----------------- ..autodepend BATCH=C:\Java\1421\lib\jvm1.lib batchuser.exe: batchuser.obj $(BATCH) ilink32 /Tpe/ap/c/x/Gn c0x32 batchuser,batchuser,, \ noeh32 $(BATCH) import32 cw32 batchuser.obj: batchuser.c bcc32 -c -RT- -x- batchuser.c ----------------- The backslash is a continuation char. I used it mostly because the news reader would otherwise word wrap the line, making it into something that wouldn't work in a make file. -RT- no runtime type id. RTTI (C doesn't use it) -x- no exception handling, EH (C doesn't use that either) noeh32.lib lib to stub any RTTI and EH links found in the libraries The .autodepend directive causes make.exe to check the object file records for header files that are used against the time and date stamp of the object file. For instance if C:\Java\1421\include\jni.h were modified since the last compile, that would be detected and another compile would done during the make. To see the command line syntax for the linker Start the help Click on the Index tab Type ILINK32 into the edit control Click the Display button For help on using the compiler, repeat the above with BCC32 in the edit control. The help file is a bit sparce on what it says about make.exe. You can find out a bit more at these sites: U of Catania copy of make.exe documentation PDF file copied sideways for printing in landscape mode For reading on the screen tell Adobe Acrobat to rotate it http://www.dmi.unict.it/~pappalar/lab3/makedoc_2.pdf ClipX docs on make.exe http://www.clipx.net/ng/make4/index.php .. Ed > peter wrote in message > news:3fa9796e$1@newsgroups.borland.com... > > makefile is: > " > BATCH=C:\Java\1421\lib\jvm1.lib > > batchuser.exe: batchuser.obj $(BATCH) > ILINK32 -L -aa batchuser.obj,,, $(BATCH) > > batchuser.obj: batchuser.c > bcc32 -c batchuser.c > " > > batchuser.c is: > " > #include > #include > #include "C:\Java\1421\include\jni.h" > > void main () { > > JNIEnv *env; > JavaVM *jvm; > JDK1_1InitArgs vm_args; > jint res; > jclass cls; > jmethodID mid; > jstring jstr; > jobjectArray args; > char classpath[1024]; > > printf("someday we will have output to follow this:\n"); > //after this we will have a call to some batch stuff.... > printf("now we will link some stuff!:\n"); > > > /* IMPORTANT: specify vm_args version # if you use > JDK1.1.2 and beyond */ > vm_args.version = 0x00010001; > > JNI_GetDefaultJavaVMInitArgs(&vm_args); > > /* Append USER_CLASSPATH to the end of default > system class path */ > > vm_args.classpath = classpath; > > /* Create the Java VM */ > res = JNI_CreateJavaVM(&jvm,&env,&vm_args); > printf("ALL DONE!!!\n"); > }//end main > " .