Description
Brief Description
Love CppSharp compared to the alternatives. Was my first time using it and tested it on something small. I am pretty sure I am abusing CppSharp in ways one shouldn't as I didn't see most of the other generators using it doing similar. Still it was able to do some magical mapping. I am sure this may be in part due to #984 as I already rename several things to make CppSharp 'discover' the class possibility (and declare a fake typedef).
One item I wasn't able to figure out was how to change a C function to a constructor for the class I forced.
Here is my attempt to build it from scratch: https://github.com/mitchcapper/WebUIAutoBuild/blob/master/CodeGen/WebUIGenerator.cs#L114-#L133
I was able to call the static method WebUI.NewWindow just unable to turn it into a constructor (through CPPGen clearly able to write that myself as in: https://github.com/mitchcapper/WebUIAutoBuild/blob/master/WebUILib/WebUIClassAdditions.cs#L8-L10 ).
Here is the original C-header:
https://github.com/webui-dev/webui/blob/55e38e89cec3fee18432e19ff4401c9e23c2ef36/include/webui.h
the https://github.com/mitchcapper/WebUIAutoBuild does have the complete code used.
One other item somewhat related to method generation and likely related to #1726 was trying to get CppSharp to wrap a function pointer that had an arg of one of the classes. I verified it was reading the type correctly, but even when I tried to manually force the type at different points it eventually always got changed to an IntPtr. I added a typedef for a delegate which made it a bit more clear what it was for (even if the delegate still just took an intptr).
Generating the wrapper though is quite generic but would involve changing the actual delegate passed to the caller and then calling the GetOrCreateInstance. Example https://github.com/mitchcapper/WebUIAutoBuild/blob/master/WebUILib/WebUIClassAdditions.cs#L18-L21 .
It is quite possible both these things are doable with CppSharp and I just missed how. Most of the items I figured out through the debugger attached to manually written C code to see what CppSharp was expecting to get the desired c#.