-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C API #65
Comments
Good idea! I haven't thought about this before. Just to make sure, are you thinking to compile dvui into a static library and call the functions from C? I think this should work with some modifications (adding extern to various functions). Give me some time and I'll try to make a prototype example. |
@david-vanderson Yeah, exactly that |
@VarLad you might be better off using imgui with C. Zig has types like |
I also recommend dear imgui, but I suspect you already know about it. In any case it will still be useful to see if exposing a C API can be done. |
It can be done but it is difficult. Every |
I spent some time digging into this. It seems like this should be possible, but is currently not well supported. ziglang/zig#9698 looks like the tracking issue for this in zig. I was able to use And this is all before getting into the issues that @iacore listed. @VarLad It looks like this isn't the right time to attempt this, do you agree? Maybe we should revisit this after zig 0.12 is released and see if things have gotten better. |
I agree with that. We can revisit the issue after Zig 0.12 release. |
The tracking issue has 0.13.0 milestone set 😭 |
Good point. If 0.12 doesn't fix it, then we might have to try doing it "manually" - using |
I did a little bit of testing related to this in C. It does appear to be possible to recreate zig's #include <stdio.h>
#define SRC {__FILE__, __LINE__}
typedef struct {
char*file;
int line;
} Source;
int main() {
Source a = SRC;
printf("%s%i", a.file, a.line);
} |
That is very interesting - well done! |
I would love to use this in projects outside Zig as well.
Any idea if this project can provide a C API?
The text was updated successfully, but these errors were encountered: