| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include <dart_api.h> | 8 #include <dart_api.h> |
| 9 | 9 |
| 10 int main(void) { | 10 #include "bin/log.h" |
| 11 fprintf(stderr, "Calling Dart_SetVMFlags\n"); | 11 |
| 12 fflush(stderr); | 12 namespace dart { |
| 13 namespace bin { |
| 14 |
| 15 int Main() { |
| 16 Log::Print("Calling Dart_SetVMFlags\n"); |
| 13 if (!Dart_SetVMFlags(0, NULL)) { | 17 if (!Dart_SetVMFlags(0, NULL)) { |
| 14 fprintf(stderr, "Failed to set flags\n"); | 18 Log::PrintErr("Failed to set flags\n"); |
| 15 fflush(stderr); | |
| 16 return -1; | 19 return -1; |
| 17 } | 20 } |
| 18 fprintf(stderr, "Calling Dart_Initialize\n"); | 21 Log::Print("Calling Dart_Initialize\n"); |
| 19 fflush(stderr); | |
| 20 char* error = Dart_Initialize( | 22 char* error = Dart_Initialize( |
| 21 NULL, NULL, NULL, | 23 NULL, NULL, NULL, |
| 22 NULL, NULL, NULL, NULL, | 24 NULL, NULL, NULL, NULL, |
| 23 NULL, | 25 NULL, |
| 24 NULL, | 26 NULL, |
| 25 NULL, | 27 NULL, |
| 26 NULL, | 28 NULL, |
| 27 NULL, | 29 NULL, |
| 28 NULL, | 30 NULL, |
| 29 NULL); | 31 NULL); |
| 30 if (error != NULL) { | 32 if (error != NULL) { |
| 31 fprintf(stderr, "VM initialization failed: %s\n", error); | 33 Log::PrintErr("VM initialization failed: %s\n", error); |
| 32 fflush(stderr); | |
| 33 free(error); | 34 free(error); |
| 34 return -1; | 35 return -1; |
| 35 } | 36 } |
| 36 fprintf(stderr, "Success!\n"); | 37 |
| 37 fflush(stderr); | 38 Log::Print("Calling Dart_Cleanup\n"); |
| 39 error = Dart_Cleanup(); |
| 40 if (error != NULL) { |
| 41 Log::PrintErr("VM Cleanup failed: %s\n", error); |
| 42 free(error); |
| 43 return -1; |
| 44 } |
| 45 |
| 46 Log::Print("Success!\n"); |
| 38 return 0; | 47 return 0; |
| 39 } | 48 } |
| 49 |
| 50 } // namespace bin |
| 51 } // namespace dart |
| 52 |
| 53 int main(void) { |
| 54 return dart::bin::Main(); |
| 55 } |
| OLD | NEW |