-
Notifications
You must be signed in to change notification settings - Fork 148
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
ClangSharpPInvokeGenerator as a dotnet global tool? #46
Comments
I think that this is a good goal and it is probably usable, as is, for a good number of scenarios. However, it's worth noting there is still quite a bit of work needed overall as the current logic can't successfully parse all of the headers in the Windows SDK (which is what I'm currently trying to get working). The things that aren't handled well today are:
The first entry is really the big blocker for most scenarios, since having nested structs (generally a struct with a nested anonymous union) is fairly common. |
Adding some tests, in the form of some in memory header files that are parsed and checked against an output, would also be useful (and is on my list of things to add). |
The code now handles nested declarations and with #55, it will support excluding any named declaration and remapping any name, which gives it quite a bit more flexibility for generating bindings how you want. It should also be able to more readily process arbitrary header files now without falling over on itself and with the testing framework in place, we can validate that things are emitting code correctly and more readily respond to bugs now. |
Any long term plans extend this to C++? |
The latest code should handle some basic C++ scenarios and create valid bindings for both virtual and non-virtual instance methods. It does not correctly handle virtual methods when multiple-inheritance exists (and therefore more than one vtbl can exist). |
I hope to have the global tool package published within the next few days. I'm mostly just going over some remaining Win32 header files to ensure it is handling the various scenarios correctly first. |
FWIW, there's a version of ClangSharpPInvokeGenerator available on NuGet, but it fails to install because it has references to other NuGet packages: error NU1212: Invalid project-package combination for ClangSharpPInvokeGenerator 8.0.0-beta. DotnetToolReference project style can only contain references of the DotnetTool type
The tool package could not be restored.
Tool 'clangsharppinvokegenerator' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool You'll likely need to mark those references as |
The error message is due to it not being marked as a .NET Core tool. This was resolved back in #101 and validated locally that installing and using the tool works.
This is the problematic part of shipping ClangSharpPInvokeGenerator as a global tool. Currently, there is no way to ship RID specific versions of a global tool and packaging the native assets for all 10 supported runtime ids is going to be a non starter. The next "best" alternative is to require users to manually copy the dependency over one time with instructions on first run that they should ensure |
Cool, thanks! I guess you could consider packaging |
Unfortunately it isn't due to ABI stability, its just due to the sheer size of the libclang binaries even when compressed. If we just include support for If we look at adding |
A beta package has been uploaded and can be installed via |
Given the improvements in correctness and usability, maybe time to consider making this a dotnet global tool?
The text was updated successfully, but these errors were encountered: