status-go/vendor/github.com/siphiuel/lc-proxy-wrapper/cb.nim

28 lines
527 B
Nim
Raw Normal View History

2022-10-31 15:52:21 +00:00
{.pragma: some, header: "cb.h".}
type
OnHeaderCallback = proc (s: cstring) {.cdecl.}
proc callbackFn(json: string) {.exportc, cdecl.} =
echo "callbackFn", json
# callbackFn "some"
proc HelloFromNim(): cstring {.exportc.} =
return "Hello, World From Nim\n"
var headerCallback: OnHeaderCallback
proc setHeaderCallback*(cb: OnHeaderCallback) {.exportc.} =
headerCallback = cb
proc invokeHeaderCallback*() {.exportc.} =
headerCallback("inside Nim 2222")
proc testEcho*() {.exportc.} =
echo "in testEcho"