Skip to content
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

clang_EnumDecl_isScoped not found #43

Closed
danyhm opened this issue Feb 17, 2021 · 10 comments
Closed

clang_EnumDecl_isScoped not found #43

danyhm opened this issue Feb 17, 2021 · 10 comments
Labels
question Further information is requested

Comments

@danyhm
Copy link

danyhm commented Feb 17, 2021

Hi,

after a long day, I finally managed to supply the right arguments for the MingW64 8.1.0 Include folders and try to parse a header based on that.

however I think the Enum parser is broken (all other parsers work fine) , and when the parser sees an enum i get this exception in the visual studio 2019 debugger :

System.EntryPointNotFoundException: 'Unable to find an entry point named 'clang_EnumDecl_isScoped' in DLL 'libclang'.'
in CppModelBuilder.cs line 1039:cppEnum.IsScoped = cursor.EnumDecl_IsScoped;

the same error is produced if I try the sample from the main page with an enum in it:

var compilation = CppParser.Parse(@"
enum MyEnum { MyEnum_0, MyEnum_1 };
void function0(int a, int b);
struct MyStruct { int field0; int field1;};
typedef MyStruct* MyStructPtr;
"
);

any ideas?

@xoofx
Copy link
Owner

xoofx commented Feb 17, 2021

Which version of CppAst.NET are you using?

@xoofx xoofx added the question Further information is requested label Feb 17, 2021
@danyhm
Copy link
Author

danyhm commented Feb 17, 2021

I cloned the git repo, so I'm on the last commit of the master branch.

@xoofx
Copy link
Owner

xoofx commented Feb 17, 2021

Can't reproduce this on master + Windows. Are you running on Linux or MacOS maybe?

@xoofx
Copy link
Owner

xoofx commented Feb 17, 2021

Also inspecting the local libclang.dll file and I can see the symbol clang_EnumDecl_isScoped exported, so I believe that you have something weird on your setup as it doesn't seem to load the correct libclang.dll.

@danyhm
Copy link
Author

danyhm commented Feb 18, 2021

I'm on windows. and you're right the function is exported. this is very strange. i think it has to be something related to .net platform maybe?

@xoofx
Copy link
Owner

xoofx commented Feb 18, 2021

Can you share your csproj?

@danyhm
Copy link
Author

danyhm commented Feb 18, 2021

yes sure

CppAst.NET-error.zip

@xoofx
Copy link
Owner

xoofx commented Feb 18, 2021

Ok, so that's because you need to add this line to your csproj:

  <PropertyGroup>
    <!-- Workaround for issue https://github.com/microsoft/ClangSharp/issues/129 -->
    <RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' AND '$(PackAsTool)' != 'true'">$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
  </PropertyGroup>

as it is done in the tests, otherwise it won't copy the correct libclang DLL and might start to use another mismatching arch on your path...
Same if you consume the package.

@danyhm
Copy link
Author

danyhm commented Feb 18, 2021

thanks ! that solved the problem !

@danyhm danyhm closed this as completed Feb 18, 2021
@xoofx
Copy link
Owner

xoofx commented Feb 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants