libffi/examples/plugin.nim
Arnaud Castellanos Galea 4c880db828 Update Examples
2020-10-05 10:23:43 +08:00

10 lines
317 B
Nim

# Compile with: nim c --noMain --app:lib plugin.nim
proc hello(x: int32) {.cdecl, exportc, dynlib.} =
echo "Hello world, ", x
proc highFive(): int32 {.cdecl, exportc, dynlib.} =
result = 5
echo "Here you go!"
proc helloFancy(f: proc (n: int32): int32 {.cdecl.}) {.exportc.} =
echo "Such fancyness, ", f(42)