1999-03-29 21:39:46 +04:00
|
|
|
/*
|
2001-01-22 18:13:41 +03:00
|
|
|
* "$Id: fl_call_main.c,v 1.1.2.8 2001/01/22 15:13:40 easysw Exp $"
|
1999-03-29 21:39:46 +04:00
|
|
|
*
|
2001-01-22 18:13:41 +03:00
|
|
|
* Copyright 1998-2001 by Bill Spitzak and others.
|
1999-03-29 21:39:46 +04:00
|
|
|
*
|
|
|
|
* fl_call_main() calls main() for you Windows people. Needs to be done in C
|
|
|
|
* because Borland C++ won't let you call main() from C++.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
2000-06-06 01:21:24 +04:00
|
|
|
* Please report all bugs and problems to "fltk-bugs@fltk.org".
|
1999-03-29 21:39:46 +04:00
|
|
|
*/
|
|
|
|
|
1999-10-14 08:56:09 +04:00
|
|
|
/*
|
1999-10-26 00:32:49 +04:00
|
|
|
* This WinMain() function can be overridden by an application and
|
|
|
|
* is provided for compatibility with programs written for other
|
|
|
|
* operating systems that conform to the ANSI standard entry point
|
|
|
|
* "main()". This will allow you to build a WIN32 Application
|
|
|
|
* without any special settings.
|
|
|
|
*
|
|
|
|
* Because of problems with the Microsoft Visual C++ header files
|
|
|
|
* and/or compiler, you cannot have a WinMain function in a DLL.
|
|
|
|
* I don't know why. Thus, this nifty feature is only available
|
|
|
|
* if you link to the static library.
|
|
|
|
*
|
|
|
|
* Currently the debug version of this library will create a
|
|
|
|
* console window for your application so you can put printf()
|
|
|
|
* statements for debugging or informational purposes. Ultimately
|
|
|
|
* we want to update this to always use the parent's console,
|
|
|
|
* but at present we have not identified a function or API in
|
|
|
|
* Microsoft(r) Windows(r) that allows for it.
|
|
|
|
*/
|
1999-10-14 08:56:09 +04:00
|
|
|
|
1999-11-30 16:14:27 +03:00
|
|
|
#if defined(WIN32) && !defined(FL_DLL) && !defined (__GNUC__)
|
1999-10-14 08:56:09 +04:00
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
1999-03-29 21:39:46 +04:00
|
|
|
extern int main(int, char *[]);
|
1999-11-30 16:14:27 +03:00
|
|
|
#ifdef BORLAND5
|
|
|
|
#define __argc _argc
|
|
|
|
#define __argv _argv
|
|
|
|
#endif
|
1999-03-29 21:39:46 +04:00
|
|
|
extern int __argc;
|
|
|
|
extern char **__argv;
|
|
|
|
|
1999-10-14 08:56:09 +04:00
|
|
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|
|
|
LPSTR lpCmdLine, int nCmdShow) {
|
|
|
|
#ifdef _DEBUG
|
1999-10-26 00:32:49 +04:00
|
|
|
/*
|
|
|
|
* If we are using compiling in debug mode, open a console window so
|
|
|
|
* we can see any printf's, etc...
|
|
|
|
*
|
|
|
|
* While we can detect if the program was run from the command-line -
|
|
|
|
* look at the CMDLINE environment variable, it will be "WIN" for
|
|
|
|
* programs started from the GUI - the shell seems to run all WIN32
|
|
|
|
* applications in the background anyways...
|
|
|
|
*/
|
1999-10-14 08:56:09 +04:00
|
|
|
|
|
|
|
AllocConsole();
|
|
|
|
freopen("conin$", "r", stdin);
|
|
|
|
freopen("conout$", "w", stdout);
|
|
|
|
freopen("conout$", "w", stderr);
|
1999-10-26 00:32:49 +04:00
|
|
|
#endif /* _DEBUG */
|
1999-10-14 08:56:09 +04:00
|
|
|
|
1999-10-26 00:32:49 +04:00
|
|
|
/* Run the standard main entry point function... */
|
1999-03-29 21:39:46 +04:00
|
|
|
return main(__argc, __argv);
|
|
|
|
}
|
1999-10-14 08:56:09 +04:00
|
|
|
|
|
|
|
#endif
|
1999-03-29 21:39:46 +04:00
|
|
|
|
|
|
|
/*
|
2001-01-22 18:13:41 +03:00
|
|
|
* End of "$Id: fl_call_main.c,v 1.1.2.8 2001/01/22 15:13:40 easysw Exp $".
|
1999-03-29 21:39:46 +04:00
|
|
|
*/
|
|
|
|
|