From bb79cdce421df0e84e1c468a010039bd050d6c10 Mon Sep 17 00:00:00 2001 From: Peter Drahos Date: Sun, 3 Mar 2013 14:35:07 +0100 Subject: Added winmain entry for wlua target --- CMakeLists.txt | 2 +- src/wmain.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/wmain.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 86cba99..5551629 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ target_link_libraries ( lua liblua ) # On windows a variant of the lua interpreter without console output needs to be built if ( LUA_BUILD_WLUA ) - add_executable ( wlua WIN32 ${SRC_LUA} ${LUA_RC} ) + add_executable ( wlua WIN32 src/wmain.c ${SRC_LUA} ${LUA_RC} ) target_link_libraries ( wlua liblua ) install_executable ( wlua ) endif ( ) diff --git a/src/wmain.c b/src/wmain.c new file mode 100644 index 0000000..6cf3e57 --- /dev/null +++ b/src/wmain.c @@ -0,0 +1,16 @@ +#include +#include /* declaration of __argc and __argv */ + +extern int main(int, char **); + +int PASCAL WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int ncmdshow) +{ + int rc; + + extern int __argc; /* this seems to work for all the compilers we tested, except Watcom compilers */ + extern char** __argv; + + rc = main(__argc, __argv); + + return rc; +} -- cgit v1.2.1