I'm trying to use nimterop to generate some bindings to my system installation
of <https://apr.apache.org>/ (which I need to bind against Subversion), and was
running into <https://github.com/nimterop/nimterop/issues/206>. I don't
understand this comment:
> Since it is imported and not included like cImport() has to, reordering will
> work as expected.
Running `nim c src/genwrapper.nim` on this file doesn't work, and neither does
`import wrap` on another file:
import nimterop/[cimport, build, paths]
cIncludeDir("/usr/include/apr-1")
cPlugin:
import strutils
proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
sym.name = sym.name.strip(chars = {'_'})
sym.name = sym.name.replace("__", "_")
if sym.name == "APR_NO_FILE":
sym.name = "APR_NO_FILE_DEF"
cImport(
@[
"/usr/include/apr-1/apr.h"
],
recurse = true, nimfile = "wrap.nim")
Run
Both fail with
Error: undeclared identifier: 'apr_size_t'
since one of the constants uses `apr_size_t` which comes before the type
definition. What's the correct strategy here?