> That lclang issue talks about how to fix it on ubuntu, and is fairly involved > (not sure why a system-installed library should need all that) so it doesn't > really help me on mac. I have no /usr/lib/llvm-*, for example.
Well it's just a matter of figuring out where libclang installed the files. This shouldn't be an issue, but apparently some Linuxes and Mac likes to put these somewhere else than the library path for whatever reason. As soon as you find `libclang.dynlib` on your system it should be as easy as pointing the C compiler to where that is with Macs equivalent of `LD_LIBRARY_PATH` and it should build fine. This might be of assistance: <https://stackoverflow.com/questions/6000554/clang-complete-where-is-the-libclang-so-dylib-in-os-x> > Ah, hmm. That was not at all clear from docs/blogs/etc, but I will try that > if disabling GC starts failing. I see that you added some commits which uses sequences, so chances are you'll run into issues sooner rather than later. Even if nothing crashes your memory consumption will just keep increasing since there is no GC to clean it up for you. > That sounds interesting. Honestly, I can't really make heads or tails of the > docs. I may just be too new at nim/c. My jenky path of sort of cobbling > things together and generating parts with c2nim, then adding some cdecl, > importc, compile pragmas seems really straightforward to me, even though it's > a bit clunky. Like I just made this in about half an hour. It's unfortunate that the docs are hard to understand, if you want to join the live chat we can discuss what you're struggling with a bit easier, and maybe we can improve the docs together. The problem with doing it the janky way is that while it might seem to be working it can have subtle and incredibly hard to debug errors. And while you can wrap something like `pntr` in about half an hour it will scale linearly with the complexity of the project, and all your work will have to be manually checked if they every push an update to the API. The time you spend learning Futhark might seem like a waste now, but I was able to make this in about 15 minutes, most of it was spent mucking about with getting RED correctly: import strutils import futhark proc renameCallback(name, kind, partof: string): string = return name.replace("pntr_", "") importc: define "PNTR_PIXELFORMAT_RGBA" define "PNTR_IMPLEMENTATION" renameCallback renameCallback path "." "pntr.h" static: writeFile("pntr.c", """ #define PNTR_PIXELFORMAT_RGBA #define PNTR_IMPLEMENTATION #include "pntr.h" """) {.compile: "pntr.c".} let RED = color(anon0: colorAnon0T(r: 230.char, g: 41.char, b: 55.char, a: 255.char)) var canvas = new_image(80, 80) draw_circle(canvas, 40, 40, 30, RED) echo save_image(canvas, "demo.png") Run Of course anything but the last three lines could be put in a `pntr.nim` file instead. This wrapper is almost guaranteed to be correct, and if they ever push an update this will update with the C code. If you spend the time learning Futhark on this relatively simple project you'll have a very powerful tool in your belt if you ever need to wrap C code with any real complexity.