diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-04-02 23:44:50 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-04-02 23:44:50 +0200 |
commit | 57b7c45128bc4257157ce905537db2f3fb970b7b (patch) | |
tree | 98db34a7b987dd7135792615a58e75ba58e15e38 /compiler/cgen.nim | |
parent | c785066ee343268c5ef9c19c4d334a0f1e8e8c48 (diff) | |
parent | cab2ce7e8770f35561f002bab601358a09535ef2 (diff) | |
download | Nim-57b7c45128bc4257157ce905537db2f3fb970b7b.tar.gz |
Merge branch 'devel' into araq
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r-- | compiler/cgen.nim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index ebdbffa5a..fd15d0793 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -966,6 +966,19 @@ proc genMainProc(m: BModule) = MainProcs & "}$N$N" + GenodeNimMain = + "Libc::Env *genodeEnv;$N" & + NimMainBody + + ComponentConstruct = + "void Libc::Component::construct(Libc::Env &env) {$N" & + "\tgenodeEnv = &env;$N" & + "\tLibc::with_libc([&] () {$n\t" & + MainProcs & + "\t});$N" & + "\tenv.parent().exit(0);$N" & + "}$N$N" + var nimMain, otherMain: FormatStr if platform.targetOS == osWindows and gGlobalOptions * {optGenGuiApp, optGenDynLib} != {}: @@ -976,6 +989,9 @@ proc genMainProc(m: BModule) = nimMain = WinNimDllMain otherMain = WinCDllMain m.includeHeader("<windows.h>") + elif platform.targetOS == osGenode: + nimMain = GenodeNimMain + otherMain = ComponentConstruct elif optGenDynLib in gGlobalOptions: nimMain = PosixNimDllMain otherMain = PosixCDllMain |