import print import system/ctypes {.link: "./cysimdjsonc.o".} {.link: "./simdjson.o".} proc newParser(): pointer {.importcpp: "cysimdjson_parser_new", header: "cysimdjsonc.h".} proc elementSizeof(): csize_t {.importcpp: "cysimdjson_element_sizeof", header: "cysimdjsonc.h".} proc parserParse(parser: pointer, element: pointer, data: cstring, len: csize_t): bool {.importcpp: "cysimdjson_parser_parse", header: "cysimdjsonc.h".} var parser = newParser() var s = cstring("{'cat': 'dog'}") var element = alloc0(elementSizeof()) var success = parserParse(parser, element, s, csize_t(len(s)))