Skip to content

Commit d61a09b

Browse files
committed
[skiplang/runtime] Fix warning about main being extern "C".
1 parent cedee9b commit d61a09b

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

skiplang/prelude/runtime/runtime64_specific.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -285,26 +285,6 @@ void sk_init(int pargc, char** pargv) {
285285
SKIP_destroy_Obstack(saved);
286286
}
287287

288-
#ifdef SKIP_LIBRARY
289-
__attribute__((constructor)) static void lib_init() {
290-
argc = 1;
291-
char* argv0 = strdup("library");
292-
argv = (char**)malloc(2 * sizeof(char*));
293-
argv[0] = argv0;
294-
argv[1] = NULL;
295-
sk_init(argc, argv);
296-
}
297-
#else
298-
int main(int pargc, char** pargv) {
299-
std::set_terminate(terminate);
300-
// TODO: Make memory initialization read state.db path from the environment
301-
// rather than command line arguments, and let the above constructor handle
302-
// it.
303-
sk_init(pargc, pargv);
304-
skip_main();
305-
}
306-
#endif // SKIP_LIBRARY
307-
308288
static void print(FILE* descr, char* str) {
309289
size_t size = SKIP_String_byteSize((char*)str);
310290
fwrite(str, size, 1, descr);
@@ -638,3 +618,23 @@ void SKIP_js_delete_fun() {
638618
// Not implemented
639619
}
640620
}
621+
622+
#ifdef SKIP_LIBRARY
623+
__attribute__((constructor)) static void lib_init() {
624+
argc = 1;
625+
char* argv0 = strdup("library");
626+
argv = (char**)malloc(2 * sizeof(char*));
627+
argv[0] = argv0;
628+
argv[1] = NULL;
629+
sk_init(argc, argv);
630+
}
631+
#else
632+
int main(int pargc, char** pargv) {
633+
std::set_terminate(terminate);
634+
// TODO: Make memory initialization read state.db path from the environment
635+
// rather than command line arguments, and let the above constructor handle
636+
// it.
637+
sk_init(pargc, pargv);
638+
skip_main();
639+
}
640+
#endif // SKIP_LIBRARY

0 commit comments

Comments
 (0)