diff options
author | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:56:41 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:59:33 -0800 |
commit | d577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch) | |
tree | 590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /iup/src/win/iupwindows_main.c |
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'iup/src/win/iupwindows_main.c')
-rwxr-xr-x | iup/src/win/iupwindows_main.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/iup/src/win/iupwindows_main.c b/iup/src/win/iupwindows_main.c new file mode 100755 index 0000000..ea7e2ae --- /dev/null +++ b/iup/src/win/iupwindows_main.c @@ -0,0 +1,66 @@ +/** \file + * \brief Windows Driver WinMain + * + * See Copyright Notice in "iup.h" + */ + +#include <windows.h> + +#include <stdlib.h> /* declaration of __argc and __argv */ + +#include "iup.h" + + +#ifdef __WATCOMC__ /* force Watcom to link this module, called from IupOpen */ +void iupwinMainDummy(void) +{ + return; +} +#else +extern int main(int, char **); +#endif + +/* save this handle in DllMain only, use to load resources from the DLL. */ +HINSTANCE iupwin_dll_hinstance = 0; + +#ifdef IUP_DLL +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + (void)fdwReason; + (void)lpvReserved; + + iupwin_dll_hinstance = hinstDLL; + + return TRUE; +} +#else +/* this module is always linked in the makefile, + But it must not define WinMain if building the DLL */ +int PASCAL WinMain (HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int ncmdshow) +{ + (void)hinst; /* NOT used */ + (void)hprev; + (void)cmdline; + (void)ncmdshow; + + /* WinMain is NOT called for Console applications */ + +#ifdef __WATCOMC__ + { + extern int _argc; + extern char** _argv; + return IupMain(_argc, _argv); + } +#else + { + /* this seems to work for all the compilers we tested, except Watcom compilers */ + /* These are declared in <stdlib.h>, except for Cygwin. */ +#ifdef __GNUC__ + extern int __argc; + extern char** __argv; +#endif + return main(__argc, __argv); + } +#endif +} +#endif |