From 5ef2984dc4d3957d8d4d005179a280bbe7b2b07f Mon Sep 17 00:00:00 2001 From: Carlos Madrazo Date: Tue, 21 Jul 2015 08:29:40 -0500 Subject: [PATCH] Main.cpp for static linking in legacy Similar to non-legacy static linking --- legacy/templates/cpp/static/Main.cpp | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 legacy/templates/cpp/static/Main.cpp diff --git a/legacy/templates/cpp/static/Main.cpp b/legacy/templates/cpp/static/Main.cpp new file mode 100644 index 000000000..deb0932e3 --- /dev/null +++ b/legacy/templates/cpp/static/Main.cpp @@ -0,0 +1,39 @@ +#include + +#ifdef HX_WINDOWS +#include +#endif + +extern "C" const char *hxRunLibrary (); +extern "C" void hxcpp_set_top_of_stack (); + +extern "C" int lime_legacy_register_prims(); +::foreach ndlls::::if (registerStatics):: +extern "C" int ::nameSafe::_register_prims ();::end::::end:: + + +#ifdef HX_WINDOWS +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 (); + + lime_legacy_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; + +}