Hello!
I am trying to make a wrapper for the edlib library. It can be found here. I'm sure I'm missing something simple, but when I try to run the small test in my repo (nim c -r tests/tnimedlib.nim), I just get an error message
/.nimble/pkgs/nimedlib-0.1.0/nimedlib/edlib.nim(56, 6) Error: implementation of 'nimedlib.edlibFreeAlignResult(result: EdlibAlignResult)[declared in ../../../.nimble/pkgs/nimedlib-0.1.0/nimedlib/edlib.nim(56, 5)]' expected
To me this would indicate that the function wasn't in the cpp file, but it is, and all the other functions are found just fine it appears. I am not an expert in C land by any means though, so perhaps it's not that simple. Any pointers are appreciated!
I am not an expert in C land by any means
Same here. But still, nimterop was very useful to me to help wrapper few C libraries.
Looking at the edlib.h, I think that nimterop would be able to handle it.
To get nimterop, do:
nimble install nimterop@#head
It can be found here
In your nimedlib.nim, you have:
include nimedlib/edlib
But that included file isn't committed to the repo. Also, why would you have just a wrapper containing an include? If you are planning on adding more procs around the wrapped functions here, why not use import?
I just made a test, it's work, what happend with you?
https://gist.github.com/NamPNQ/4afdd8926a2ce840ee3966eb16fb113f
But that included file isn't committed to the repo.
That file is actually generated by nimgen on install.
Glad to hear both nimgen and nimterop worked for you. Open to any feedback from your experience with both tools. As such, I'm migrating all nimgen projects to nimterop, assuming the target library is C since nimterop doesn't support C++ yet.
For C++ libraries, my current suggestion is to use nimterop to pull and preprocess but to use c2nim for wrapping.
Thanks for the reply! As a fairly naive user I was able to get going, but one or two 'tutorial' style guides would be super helpful. I mostly pieced things together by looking at the tests. Having the same example projects that are in nimgen will help nimterop a lot. They are why I tried nimgen first.
Overall though, thank you for making such awesome tools!
I specifically put together template.nim and templite.nim for this. Hope it helps going forward. I've linked them from the README and the documentation.
Regardless, a blog post is warranted.