When building a Lime application in debug mode on Windows, the console subsystem is used and Windows looks for a 'main' function. However, the Main.cpp file used when linking statically always defines a 'WinMain' function regardless of whether the application is being built in debug mode. This commit adds an additional check in the Main.cpp that defines a 'main' function instead of 'WinMain' when building in debug mode.
44 lines
972 B
C++
44 lines
972 B
C++
#include <stdio.h>
|
|
|
|
#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUG)
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
extern "C" const char *hxRunLibrary ();
|
|
extern "C" void hxcpp_set_top_of_stack ();
|
|
|
|
extern "C" int zlib_register_prims ();
|
|
extern "C" int lime_cairo_register_prims ();
|
|
extern "C" int lime_openal_register_prims ();
|
|
::foreach ndlls::::if (registerStatics)::
|
|
extern "C" int ::nameSafe::_register_prims ();::end::::end::
|
|
|
|
|
|
#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUG)
|
|
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
|
#else
|
|
extern "C" int main(int argc, char *argv[]) {
|
|
#endif
|
|
|
|
hxcpp_set_top_of_stack ();
|
|
|
|
zlib_register_prims ();
|
|
lime_cairo_register_prims ();
|
|
lime_openal_register_prims ();
|
|
::foreach ndlls::::if (registerStatics)::
|
|
::nameSafe::_register_prims ();::end::::end::
|
|
|
|
const char *err = NULL;
|
|
err = hxRunLibrary ();
|
|
|
|
if (err) {
|
|
|
|
printf("Error: %s\n", err);
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|