CppPinvokeGenerator icon indicating copy to clipboard operation
CppPinvokeGenerator copied to clipboard

Is it related to the UrhoSharp?

Open OmidID opened this issue 6 years ago • 3 comments

Do you have plan to use it in UrhoSharp? Could be nice to have better generator. Currently it's not possible to use native libraries and sample codes from Urho3D. Maybe with new generator will be possible and also would be nice to generate codes in Windows too.

OmidID avatar May 29 '19 19:05 OmidID

@OmidID Honestly, not sure, but I'll try.

EgorBo avatar May 29 '19 19:05 EgorBo

Perfect! I hope to receive good news from you :) Thanks

OmidID avatar May 29 '19 19:05 OmidID

I try to bind Urho3D header files and I got an error

var options = new CppParserOptions();
// TODO: test on macOS
options.ConfigureForWindowsMsvc(CppTargetCpu.X86_64);
options.AdditionalArguments.Add("-std=c++17");
options.IncludeFolders.Add(outputFolder);
options.IncludeFolders.Add(Path.Combine(outputFolder, "Urho3D", "ThirdParty"));
CppCompilation compilation = CppParser.ParseFile(Path.Combine(outputFolder, @"Urho3DAll.h"), options);

Error: System.ArgumentException: 'An item with the same key has already been added. Key: c:@T@RPCNOTIFICATION_ROUTINE'

   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at CppAst.CppModelBuilder.VisitTypeDefDecl(CXCursor cursor, CXCursor parent, CXClientData data)
   at CppAst.CppModelBuilder.VisitMember(CXCursor cursor, CXCursor parent, CXClientData data)
   at CppAst.CppModelBuilder.VisitTranslationUnit(CXCursor cursor, CXCursor parent, CXClientData data)
   at ClangSharp.clang.visitChildren(CXCursor parent, CXCursorVisitor visitor, CXClientData client_data)
   at CppAst.CppParser.ParseInternal(List`1 cppFiles, CppParserOptions options)
   at CppAst.CppParser.ParseFiles(List`1 cppFilenameList, CppParserOptions options)
   at SimdJson.Program.Main(String[] args)

It's weird in the CppAst code i can see there is a checking before add new item to typedefs. I cannot understand why it's will be pass the checking duplicate item! https://github.com/xoofx/CppAst/blob/0.3.0/src/CppAst/CppModelBuilder.cs#L1359

OmidID avatar Jun 01 '19 10:06 OmidID