-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Description
Given the following header:
namespace N {
int f();
}the generator fails to add mangled name to the DllImport attribute. Don't really know what am I doing, but the following change seems to make it work:
diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs
index 097e5df..97bac12 100644
--- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs
+++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs
@@ -464,10 +464,10 @@ namespace ClangSharp
}
var callingConventionName = GetCallingConvention(functionDecl, callConv, name);
- var entryPoint = !isVirtual && body is null
- ? (cxxMethodDecl is null) ? GetCursorName(functionDecl) : cxxMethodDecl.Handle.Mangling.CString
+ var isDllImport = !isVirtual && body is null;
+ var entryPoint = isDllImport
+ ? (cxxMethodDecl is null) ? functionDecl.Handle.Mangling.CString : cxxMethodDecl.Handle.Mangling.CString
: null;
- var isDllImport = body is null && !isVirtual;
var desc = new FunctionOrDelegateDesc<(string Name, PInvokeGenerator This)>
{
Metadata
Metadata
Assignees
Labels
No labels