-
Notifications
You must be signed in to change notification settings - Fork 518
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
How to override #1848
Comments
Need more info to be able to help you here. |
Basically CppSharp generated a function with the following signature: public static int SP_SetProperty(__IntPtr hDiag, int lProperty, int lFlag, __IntPtr lpValue) I need to get it to change to: public static int SP_SetProperty(__IntPtr hDiag, SP_ATTR_ENUM lProperty, int lFlag, __IntPtr lpValue) What kind of approaches can I use for this? |
You can change the type of your parameter as a processing step, see for example the helper methods here: https://github.com/mono/CppSharp/blob/3f923b1/src/Generator/Library.cs#L474 You can do something like |
So this is where I got stuck. I found the FindFunction function and used it to get the function, then grabbed the right parameter, but the problem is how to I set the type to an enum? Calling FindEnum returns an Enumeration object. I'm not sure how to properly put these together. |
Think you need to do something like |
Got it. Here is the code I ended up with: ctx.FindFunction("SP_SetProperty").First().Parameters[1].QualifiedType =
new QualifiedType(new TagType(ctx.FindEnum("SP_ATTR_ENUM").First())); Would be nice to have a helper function for this as well. |
Feel free to send a PR |
Brief Description
In my situation I have a typedefed C enum that is intended to be passed as a parameter to a function. However, this function declaration merely identifies the parameter as a long so there is no way for CppSharp to figure out that the 2 are related. How can I override the parameter of this function to use the Enum type?
OS: Windows
Used headers
The text was updated successfully, but these errors were encountered: