bindings: Fixed console/unix app; Made globals local to main()
authorJerome St-Louis <jerome@ecere.com>
Wed, 1 Jun 2016 05:08:00 +0000 (01:08 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 21 Nov 2016 14:18:57 +0000 (09:18 -0500)
bindings/c/eC.h
bindings/cpp/eC.hpp
bindings/cpp/samples/sample5.cpp

index 67a0505..ae527cb 100644 (file)
@@ -56,15 +56,15 @@ extern "C"
    #define MAIN_DECLARATION int main(int argc, char * argv[])
    #ifdef __cplusplus
       #if defined(__CONSOLE_APP__)
-         #define eC_init_CALL eC_init(false, null, null);
+         #define eC_init_CALL eC_init(false, null, null)
       #else
-         #define eC_init_CALL eC_init(true, null, null);
+         #define eC_init_CALL eC_init(true, null, null)
       #endif
    #else
       #if defined(__CONSOLE_APP__)
-         #define eC_init_CALL eC_init(false, argc, argv);
+         #define eC_init_CALL eC_init(false, argc, argv)
       #else
-         #define eC_init_CALL eC_init(true, argc, argv);
+         #define eC_init_CALL eC_init(true, argc, argv)
       #endif
    #endif
 #endif
@@ -127,6 +127,7 @@ extern "C"
 
 // dllimport Functions
 #define eC_initApp               __ecereNameSpace__ecere__com____ecere_COM_Initialize
+#define eC_setArgs               __ecereNameSpace__ecere__com__eSystem_SetArgs
 #define eC_findClass             __ecereNameSpace__ecere__com__eSystem_FindClass
 #define eC_registerClass         __ecereNameSpace__ecere__com__eSystem_RegisterClass
 #define eC_new                   __ecereNameSpace__ecere__com__eSystem_New
@@ -896,6 +897,7 @@ struct class_members_SerialBuffer
 // C Exported functions
 extern __attribute__((dllimport)) Application __ecereNameSpace__ecere__com____ecere_COM_Initialize(bool guiApp, int argc, char *argv[]);
 
+extern __attribute__((dllimport)) void __ecereNameSpace__ecere__com__eSystem_SetArgs(Application app, int argc, char * argv[]);
 extern __attribute__((dllimport)) Class * __ecereNameSpace__ecere__com__eSystem_FindClass(Module module, const char *name);
 extern __attribute__((dllimport)) Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(ClassType type, const char *name, const char *baseName, int size, int sizeClass, bool (*Constructor)(void *), void (*Destructor)(void *), Module module, AccessMode declMode, AccessMode inheritanceAccess);
 extern __attribute__((dllimport)) void * __ecereNameSpace__ecere__com__eSystem_New(uint size);
index f70666d..2130d79 100644 (file)
@@ -55,7 +55,7 @@
    _CONSTRUCT(c, b)
 
 #if !defined(__WIN32__) || defined(__CONSOLE_APP__)
-   #define APP_SET_ARGS(a) eC_setArgs(a, argc, argv)
+   #define APP_SET_ARGS(a) eC_setArgs(a.impl, argc, argv);
 #else
    #define APP_SET_ARGS(a)
 #endif
index d990fe9..a46cc19 100644 (file)
@@ -34,8 +34,6 @@ public:
       onRedraw = [](Window & w, Surface & surface) { surface.writeTextf(100, 100, $("Instance Method!")); };
    }
 };
-GuiApplication app;
-HelloForm hello;
 
 extern "C" int
 #if defined(__WIN32__) && !defined(__CONSOLE_APP__)
@@ -44,8 +42,11 @@ extern "C" int
    main(int argc, char * argv[])
 #endif
 {
+   GuiApplication app;
+   HelloForm hello;
+
 #if !defined(__WIN32__) || defined(__CONSOLE_APP__)
-   eC_setArgs(app, argc, argv)
+   eC_setArgs(app.impl, argc, argv);
 #endif
    app.main();
    unloadTranslatedStrings(MODULE_NAME);