Subj : Re: Unresolved external __declspec(dllimport), and illegal instruction To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Wed Nov 17 2004 07:26 am There are a couple of problems with this. First is that you are posting a question about the command line tools from C++ Builder version 5 in the newsgroup for the old, 1997, Borland C++ compiler. You will generally enjoy more useful responses to questions when they are posted in an area whre people who use that product are found. Try posting in one of the C++ Builder newsgroups, groups with the word 'cppbuilder' in their name. >All of the unresolved reference errors went away, >with the exception of one referring to "___initenv", >which appears as follows in the source: > >__declspec(dllimport) char **__initenv; > ... > __initenv = _environ; You do not show the text of the error. There are several possible errors that could have been generated. When you post over in the C++ Builder group, please show the text of the error message. The command line looks to be a problem. I do not know if you will "get away" with it (the output shown does not complain of it). >bcc32 -5 -tW -DJAVAW -DWIN32 >"-IC:\Program Files\Borland\bcc55\Include" >"-IC:\Program Files\Java\j2sdk1.4.2_03\include" >"-DJAVA_ARGS={ \"heysen.common.ui.UiDialog_Test\" }" >"-DAPP_CLASSPATH={ \"testapp.jar\" }" The quotes should encase the argument of the -I option and not the whole item. The quotes are to identify the space in the Program Files directory name as being part of the name and not a delimiter. The items should be something like this: -I"C:\Program Files\Borland\bcc55\Include" -I"C:\Program Files\Java\j2sdk1.4.2_03\include" Note that the first of those duplicates what is already established in the bcc32.cfg file that you created when you installed the compiler. If you did not create that file then refer to the compiler's readme.txt file and create it and the ilink32.cfg files. The JAVA_ARGS and APP_CLASSPATH entries look questionable but I do not know offhand what to suggest in the way of altering them. .. Ed >MikL wrote: > >I've never used C/C++ to write a Windows app (only >console apps), and I'm >hitting an error that suggests >I'm ignorantly misusing the Bcc32 compiler ("Borland >C++ 5.5 for Win32" with "Turbo Incremental Link 5.00") >under WinXP. > >In case it's relevant, I'm attempting to compile the >Sun Java launcher (java.c + java_md.c). I've been >getting many "unresolved references" where java_md.c >calls functions in java.c, despite the presence of >good-looking function prototypes. To try to track >down the problem, I merged the source code from both >files into a single source file and compiled that. >All of the unresolved reference errors went away, >with the exception of one referring to "___initenv", >which appears as follows in the source: > >__declspec(dllimport) char **__initenv; > >int WINAPI WinMain(HINSTANCE inst, HINSTANCE >previnst, LPSTR cmdline, int cmdshow) >{ > int ret; > SetThreadLocale(GetSystemDefaultLCID()); > __initenv = _environ; > ret = main(__argc, __argv); > return ret; >} > >What do I need to do? I've been Googling, and seen >a few references to IMPLIB and COFF2OMF, but I've done >my head in trying to understand what they're used for >and how to use them...and I don't know if they're related >to my problem anyway :( I've never even built a DLL. > >The compile command I'm using is as follows. I've >broken it into multiple lines here for readability: > >bcc32 -5 -tW -DJAVAW -DWIN32 >"-IC:\Program Files\Borland\bcc55\Include" >"-IC:\Program Files\Java\j2sdk1.4.2_03\include" >"-IC:\Program Files\Java\j2sdk1.4.2_03\include\win32" >"-LC:\Program Files\Borland\bcc55\Lib" >-DJDK_MAJOR_VERSION=\"1\" >-DJDK_MINOR_VERSION=\"4\" >"-DJAVA_ARGS={ \"heysen.common.ui.UiDialog_Test\" }" >"-DAPP_CLASSPATH={ \"testapp.jar\" }" >-otestapp.exe >java_all.c > >Sadly, if I remove the references to __initenv, I get >an executable, but when I try to run it I get the >following error (in a GUI dialog): > >[TITLE: 16 bit MS-DOS Subsystem] >testapp.exe >The NTVDM CPU has encountered an illegal instruction. >CS:0e25 IP:010c OP:2e 63 00 88 13 Choose 'Close' to >terminate the application. > >Thank you for your patience in reading this far! .