-
Notifications
You must be signed in to change notification settings - Fork 153
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
Adds a 'preview-codegen' config option #123
Conversation
nameBuilder.Append("delegate"); | ||
nameBuilder.Append('*'); | ||
nameBuilder.Append(' '); | ||
nameBuilder.Append((callConv != "winapi") ? callConv : "unmanaged"); |
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.
Unmanaged is not currently supported, this will fail.
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 might just keep this for now since its a preview feature and the code will get flagged in the compilation.
We have a few cases where the generated code isn't quite right and where devs may need to manually fixup or adjust the generated code.
They can workaround it by passing in the --with-callconv RemappedName=CallConv
arg on the command line
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.
Alright, but it's going to be weird when people get a CS8XXX for this.
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'll adjust if the language ends up not allowing the keyword in the final implementation. It also shouldn't be hit today unless they are targeting something using a non-standard calling convention.
This case will already print a Unsupported calling convention
diagnostic since it isn't something we can support for P/Invoke
calls or Delegates w/ UnmanagedFunctionPointerAttribute
: https://github.com/microsoft/ClangSharp/blob/master/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs#L560
This adds a 'preview-codegen' config option that can be used to generate code compatible with the latest C# Preview Compiler. For example, it supports this PR allows it to use the
nint
/nuint
types andfunction pointers
.