I have a question, and I don't know the right place to raise it.
I am trying to wrap MuPDF. To do so, I have wrapper.nim:
import os, strformat
import nimterop/[cimport, git]
when defined(windows):
# Windows specific symbols, options and files
# Dynamic library to link against
const dynlibFile = "libmupdf.dll"
elif defined(linux):
const dynlibFile = "libmupdf.so"
else:
static: doAssert false
const
base = currentSourcePath.parentDir()
buildDir = (base / "build").sanitizePath
includeDir = (buildDir / "include").sanitizePath
echo base
static:
cDebug()
gitPull("https://github.com/ArtifexSoftware/mupdf", base, """
include/*
""")
cSkipSymbol(@[
"FZ_LANG_ur", "FZ_LANG_urd", "FZ_LANG_ko", "FZ_LANG_ja", "FZ_LANG_zh", "FZ_LANG_zh_Hans", "FZ_LANG_zh_Hant"
])
cIncludeDir includeDir
cPlugin:
import strutils
proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} =
if sym.kind == nskField and sym.name.endsWith("_"):
sym.name = sym.name.replace("_", "_priv")
cImport(includeDir/"mupdf/fitz.h", dynlib="dynlibFile", flags="-f:ast2", recurse=true) #-DHAVE_SIGSETJMP=0
When I run:
nim c wrapper.nim
I get the error:
undeclared identifier: 'sigjmp_buf'
It seems to be related with this bit of header: system.h.
If I use the flag: -DHAVE_SIGSETJMP=0, I get the error:
undeclared identifier: 'jmp_buf'
I don't know what is this about, so any clue is welcomed.
this sounds like a tough problem to debug, I doubt i'll be able to help, unless this:
cImport(includeDir/"mupdf/fitz.h", dynlib="dynlibFile", flags="-f:ast2", recurse=true)
is a typo: should that be dynlib=dynlibFile without the quotes?