CppSharp icon indicating copy to clipboard operation
CppSharp copied to clipboard

MOABSharp project (with documented process of C# binding generation and tweak)

Open qingfengxia opened this issue 4 years ago • 4 comments

Brief Description

moabsharp is a realistic example of with documented process of C# binding generation by CppSharp, with some notes on tweak and fix uncompilable code.

There are some maybe useful dotnet core project setup xml file and some notes, I hope to share with the community, since the project is driven csproj xml instead of lua build script.

Currently, there are some bit C# code does not compile, must be manually fixed, such as

  1. options.UsePropertyDetectionHeuristics = false; does not help to stop delete_mesh() C++ API been generated as property in C# which is not correct.
  2. some class has missing constructor on windows (seems for class without public default ctor, but with public ctor with some parameter), but on Linux it is fine. see details in fix error

I am planning to use Roslyn C# API to postprocessing the generated code fixing process, because I did not know how to remove and replace some problemetic C# generation in CppSharp.

And thank the developers for making moabsharp possible.

OS: Windows / OS X / Linux (include version and/or distro)

Used headers
Used settings

Target: MSVC/GCC/Clang

Other settings

Stack trace or incompilable generated code

qingfengxia avatar Apr 06 '21 21:04 qingfengxia

@qingfengxia thank you for your kind words. We'll be happy to fix these errors so that you don't have to do anything by hand. I've been working on a major feature (which might help with the missing constructors) in my limited time but I'd definitely find some if I had some isolated bug reports.

ddobrev avatar Apr 06 '21 22:04 ddobrev

Great! thank you. At the meantime, I will show how to further tweak the generated binding using Roslyn API on C# side.

qingfengxia avatar Apr 07 '21 13:04 qingfengxia

Here is my postprocessing fix, now almost manual fix can be avoided https://bitbucket.org/qingfengxia/moabsharp/src/dev/MOABSharpFix/Program.cs perhaps we can close this information thread.

qingfengxia avatar Apr 09 '21 08:04 qingfengxia

@qingfengxia when we've isolated the errors you're forced to fix in separate reports, then we'll close this one.

ddobrev avatar Apr 20 '21 21:04 ddobrev