summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-05-10 23:43:59 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-05-24 13:53:43 +0200
commitb4b7105c572d50952ae132b722fb59ffce709bb2 (patch)
treed9a6b3eca885ccb4a27b540cb556f6f93062b8d8
parent1a7ad7ab1f8a0aedffb4060ff41ae98393584165 (diff)
mingw: add standard main() entry function
Thanks Paolo for the suggestion: http://lists.freedesktop.org/archives/spice-devel/2012-May/009291.html
-rw-r--r--vdagent/vdagent.cpp4
-rw-r--r--vdservice/vdservice.cpp17
2 files changed, 20 insertions, 1 deletions
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 5cbe222..9046476 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -1355,7 +1355,11 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
return 0;
}
+#ifdef __GNUC__
+int main(int argc,char **argv)
+#else
int APIENTRY _tWinMain(HINSTANCE instance, HINSTANCE prev_instance, LPTSTR cmd_line, int cmd_show)
+#endif
{
VDAgent* vdagent = VDAgent::get();
vdagent->run();
diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index 4701f5a..9c5f569 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -1216,7 +1216,22 @@ void VDService::write_agent_control(uint32_t type, uint32_t opaque)
}
}
-int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
+#ifdef __GNUC__
+#undef _tmain
+#ifdef UNICODE
+int _tmain(int argc, TCHAR* argv[]);
+int main(void)
+{
+ int argc;
+ argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+ return _tmain(argc, argv);
+}
+#else
+#define _tmain main
+#endif
+#endif
+
+int _tmain(int argc, TCHAR* argv[])
{
bool success = false;