diff --git a/MetadataProcessor.Shared/Utility/NativeMethodsCrc.cs b/MetadataProcessor.Shared/Utility/NativeMethodsCrc.cs
index 1b6a7b0..dcb50a8 100644
--- a/MetadataProcessor.Shared/Utility/NativeMethodsCrc.cs
+++ b/MetadataProcessor.Shared/Utility/NativeMethodsCrc.cs
@@ -191,13 +191,18 @@ internal static string GetNanoCLRTypeName(TypeReference parameterType)
// check if it's generic
return "DATATYPE_GENERICTYPE";
}
- else
+ else if(parameterType.IsPointer)
{
- // this is not a generic, get full qualified type name
- string typeName = parameterType.FullName.Replace(".", String.Empty);
-
- return CleanupGenericName(typeName);
+ if (nanoSignaturesTable.PrimitiveTypes.TryGetValue(parameterType.GetElementType().FullName, out myType))
+ {
+ return $"{myType}ptr";
+ }
}
+
+ // last attempt: get full qualified type name
+ string typeName = parameterType.FullName.Replace(".", string.Empty);
+
+ return CleanupGenericName(typeName);
}
}
diff --git a/MetadataProcessor.Tests/StubsGenerationTestNFApp/NativeMethodGeneration.cs b/MetadataProcessor.Tests/StubsGenerationTestNFApp/NativeMethodGeneration.cs
index c49c1e0..a17fd0f 100644
--- a/MetadataProcessor.Tests/StubsGenerationTestNFApp/NativeMethodGeneration.cs
+++ b/MetadataProcessor.Tests/StubsGenerationTestNFApp/NativeMethodGeneration.cs
@@ -27,5 +27,8 @@ public void Method()
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern byte NativeStaticMethodReturningByte(char charParam);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ public extern unsafe void MethodWithPointerParm(void* pointer, int length);
}
-}
\ No newline at end of file
+}
diff --git a/MetadataProcessor.Tests/StubsGenerationTestNFApp/StubsGenerationTestNFApp.nfproj b/MetadataProcessor.Tests/StubsGenerationTestNFApp/StubsGenerationTestNFApp.nfproj
index 70078d5..b09e201 100644
--- a/MetadataProcessor.Tests/StubsGenerationTestNFApp/StubsGenerationTestNFApp.nfproj
+++ b/MetadataProcessor.Tests/StubsGenerationTestNFApp/StubsGenerationTestNFApp.nfproj
@@ -15,6 +15,7 @@
StubsGenerationTestNFApp
StubsGenerationTestNFApp
v1.0
+ true
True
@@ -35,4 +36,4 @@
-
\ No newline at end of file
+