Closed 8bitprodigy closed 1 month ago
Even if you solved the initial problem you'd be very likely to run into further issues using Futhark that way. What I'd recommend instead is using project mode. What it allows you to do is simply specify all the path
s you want to wrap, and then it will wrap all the header files in those paths and recreate the same folder structure. Your example would be something like:
importc:
outputPath "Nimtendo64"
path n64_inst # Assuming this is a constant holding the path to a folder
Then every header file in the folder pointed to by n64_inst
would get wrapped into separate Nim files and placed in the "Nimtendo64" folder.
Awesome! Thank you! One problem with project mode, however, is that those header files are stored alongside other header files, as they're part of a toolkit. I'll have to figure something out. Currently, I have separate importc
statements, and that one seems to fail on one of the header files, though that's a separate issue.
Well you can always use the ignore
function to ignore header files you don't want to wrap.
Actually, maybe I could do that to ignore the c++
folder, which seems to be the biggest issue when trying to use project mode.
Am I using ignore
correctly, here?
importc:
outputPath "Nimtendo64"
path n64_inst
ignore "c++"
ignore "libdragon.h"
Because it doesn't seem to be ignoring the c++
directory and the readme doesn't give an example of the syntax for how to use it.
Hard to tell without knowing the folder structure, but ignore
needs to be relative to the project being compiled, or absolute. I typically have something like:
const relPath = currentSourcePath().parentDir
importc:
path relPath / "cfiles"
ignore relPath / "cfiles" / "somefolder"
ignore
needs to be relative to the project being compiled
Okay, gotcha! I'll try that out. I'm not sure why that didn't occur to me, but I know it was getting late when I tried that, so that might have something to do with it.
So I'm trying to generate individual nim wrapper files for each header in a library (libDragon, to be specific), and I figured the best way to go about this was to create a template that I could call that would be expanded before compiling, but it doesn't seem to work, giving the following error:
Here's the
template
I wrote: