runtime/plc_Win32_main.c
changeset 57 3b53f9a509d9
parent 49 45dc6a944ab6
child 75 9ad18a387a96
--- a/runtime/plc_Win32_main.c	Tue Sep 25 10:30:51 2007 +0200
+++ b/runtime/plc_Win32_main.c	Mon Oct 01 21:44:40 2007 +0200
@@ -28,25 +28,25 @@
         return 1;
     }
 
-    __init();
+    if( __init(argc,argv) == 0 ){
 
-    // Set a timer to wait for 10 seconds.
-    if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0))
-    {
-        printf("SetWaitableTimer failed (%d)\n", GetLastError());
-        return 2;
+        // Set a timer
+        if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0))
+        {
+            printf("SetWaitableTimer failed (%d)\n", GetLastError());
+            return 2;
+        }
+    
+        while(1){
+        // Wait for the timer.
+            if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
+            {
+                printf("WaitForSingleObject failed (%d)\n", GetLastError());
+                break;
+            }
+            timer_notify();
+        }
     }
-
-    while(1){
-    // Wait for the timer.
-        if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
-        {
-            printf("WaitForSingleObject failed (%d)\n", GetLastError());
-            break;
-        }
-        timer_notify();
-    }
-
     __cleanup();
 
     return 0;