add "hello_nim" example application written by Nim.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
This commit is contained in:
Takeyoshi Kikuchi
2023-02-25 18:58:43 +09:00
committed by Alin Jerpelea
parent a594bbda7c
commit c785e32183
7 changed files with 289 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import std/asyncdispatch
import std/strformat
proc task(id: int): Future[void] {.async.} =
for loop in 0..2:
echo &"Hello from task {id}! loops: {loop}"
if loop < 2:
await sleepAsync(1000)
proc launch() {.async.} =
for id in 1..2:
asyncCheck task(id)
await sleepAsync(200)
await task(3)
proc hello_nim() {.exportc, cdecl.} =
waitFor launch()
GC_runOrc()