Open de-odex opened 2 years ago
futhark perhaps should check if nim has the type in posix or io or so before going into the C headers and generating a new type, but i can see how that would be tricky
e: i misunderstood, but the comment before this still applies
workaround for this issue is this
import std/[typetraits, os]
const clangIncludeDir {.strdefine.} = "/usr/lib/clang/13.0.0/include"
type CFile* = typeof(File.pointerBase)
importc:
absPath clangIncludeDir
path currentSourcePath() / ".." / ".." / "notcurses/include/notcurses/"
rename FILE, CFile
"notcurses.h"
Okay, I think I fully understand the idea now, what is needed is better retyping for other types like function parameter types and so so that the workaround doesn’t need to muck around redefining an internal type and could just change ptr File into File
What do you mean by better retyping? Isn't it working well for you? The problem here is that I want to keep Futhark as automatic as absolutely possible, so adding overrides for defined things isn't a great solution. But I thought FILE
was actually working, I could've sworn I've used those with a Futhark wrapped library before..
It only "works" if I manually get what the pointer base of File is and rename FILE to that. I was thinking better utilities like being able to rename a not-named type like FILE* itself into File without needing to get the pointer base
this should work (this does in a nimterop wrapper);
fp
should just beFile
orptr CFile
offending C header file (
notcurses/include/notcurses/notcurses.h
)