-
Notifications
You must be signed in to change notification settings - Fork 2
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
String marshalling fix #3
Conversation
Awesome! Gonna check that everything still works on my machine and stuff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd gladly accept this change, especially if it means making sure we're using utf-8.
But unfortunately, that change is not gonna work on Linux (and fwiw, on Mac too). :(
On non-Windows platforms, since the native charset is already utf-8, in nativefiledialog-extended, they're defined as a C macro:
https://github.com/Speykious/nativefiledialog-extended/blob/ab1e78eb5462f153d247bad309760d0bd67a6d57/src/include/nfd.h#L266-L273
I think I (or you?)'ll need to slightly modify the CppSharpGenerator so that it changes the names of the functions on non-Windows platforms.
If you know how to fix it, go right ahead. You should have push access to my branch. Otherwise, I'll take a look tomorrow. |
So far I've tried a somewhat naive approach of adding function name replacements ( |
I think the best solution might be to ask the native library author to make the API universal. A few small tweaks upstream and generating interop bindings becomes easier for all frameworks. |
If we pr that change upstream, the utf8 methods will work out of the box on all 3 platforms. However, the native methods will have cross platform differences. Currently, the CppSharp output code aligns with Windows wide characters. I propose we add |
Well that was fast :v |
I also want to pr doxygen support to the native library because that will let CppSharp pull the documentation for our library. |
I also asked about injecting attributes. |
I was able to inject the attributes! public void Postprocess(Driver driver, ASTContext ctx)
{
foreach (var function in ctx.TranslationUnits.SelectMany(t => t.Functions).Where(f => f.Name.EndsWith('N')))
{
AddWindowsOnlyAttribute(function);
}
AddWindowsOnlyAttribute(ctx.FindClass("NfdnfilteritemT").First());
}
private static void AddWindowsOnlyAttribute(Declaration declaration)
{
declaration.Attributes.Add(new Attribute() { Type = typeof(SupportedOSPlatformAttribute), Value = "\"windows\"" });
} |
A few updates:
|
Oh my god... I didn't have any Readme file all this time?? This is bad 💀 |
I'll update |
Much appreciated |
Well... apparently I don't! D:
|
What were you trying to change? Just bumping the NuGet version? |
I see. Is there anything you can do in the organization itself then? |
I added permissions for you to push to that repository, so you should be good now. |
Thanks, it worked :D |
The examples work on my end with the new versions! I'll do one more test before merging. |
I noticed that you were referencing the Autogen NuGet package. It's only necessary to reference the Runtime NuGet package due to how native libraries are used. |
Oh damn, it has actually never worked on Mac. I'm getting a |
What do you mean? As in I should turn AutoGen into a project reference instead? |
Whenever you compile, all the NuGet references will be correct in the generated packages. |
Ah right. Yeah that's what you meant. That's fine |
Hello again. I solved the issue I reported in #2. It was caused by native not being Utf8 on all platforms. I bumped CppSharp to the latest version and ran it on the header for Native File Dialog Extended
v1.1.1
.