Re: mathlink compile problem
- To: mathgroup at smc.vnet.net
- Subject: [mg28162] Re: mathlink compile problem
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 3 Apr 2001 02:37:41 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <9a1lis$acd@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, the syntax for Windows applications is #if defined(__WIN32__) || defined(WIN32_) # if MLVERSION < 3 int PASCAL WinMain(HANDLE hinstCurrent, HANDLE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow) { char buff[512]; char FAR *argv[32]; int argc; if(!MLInitializeIcon(hinstCurrent,nCmdShow)) return 1; argc=MLStringToArgv(lpszCmdLine,buff,argv,32); return MLMain(argc,argv); } # else int PASCAL WinMain(HANDLE hinstCurrent, HANDLE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow) { char buff[512]; char FAR *buff_start=buff; char FAR *argv[32]; char FAR * FAR * argv_end=argv+32; if(!MLInitializeIcon(hinstCurrent,nCmdShow)) return 1; MLScanString(argv,&argv_end,&lpszCmdLine,&buff_start); return MLMain(argv_end-argv,argv); } # endif #else int main(int argc, char *argv[]) { return MLMain(argc,argv); } #endif Microsoft has removed the good old main() function, and only console programs have a main() and commandline arguments. GUI programs *must* call WinMain(). Regards Jens Lawrence Walker wrote: > > Hi, > > I am using Microsoft Visual C++ 6.0 under NT 4.0 to compile > a mathlink program. I first attempted compiling using > "Win32 Application" per the Development Kit documentation. > I get the following error. > > "mpreping..." > Compiling... > search.c > searchtm.c > Linking... > LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved > external symbol _WinMain@16 > Debug/Search.exe : fatal error LNK1120: 1 > unresolved externals > Error executing link.exe. > > Search.exe - 2 error(s), 0 warning(s) > > However, when I compile using "Win32 Console Application" > everything compiles ok. This means the console will pop up > when I link to the mathlink program. Does anyone know how > to get Mathlink to work using the "Win32 Application" > setting? > > Thanks, > Lawrence > > -- > > ------------------------------------------------------------ > > (\___/) The fear of the LORD is the beginning of > (o\ /o) wisdom: a good understanding have all they > /|:.V.:|\ that do his commandments: his praise > \\:::::// endureth for ever. Psa 111:10 > -----`"" ""`------------------------------------------------ > > Lawrence A. Walker Jr., M.Eng./Ph.D. Candidate > Morgan State University > Clarence M. Mitchell School of Engineering > COMSARE (Center Of Microwave/Satellite And RF Engineering) > Rm: 306-Schafer Phone: (443)885-1453 > ------------------------------------------------------------