Log in

View Full Version : C# - Method's type signature is not PInvoke compatible


Gopi Chand
Nov 29, 2014, 04:55 AM
Hello friends,
Iam trying to use the VC++ (2003) dll in C# (2010)
When am calling the method of dll from c# am getting this error
"Method's type signature is not PInvoke compatible"


I am returning the structure from VC++
Code:
struct SLFData
{
public:
char ByLat[10];
char ByLong[10];
};


And I am marshalling in C#
Code:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct SLFData
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public char[] ByLat;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public char[] ByLong;
};


Yet again I get the same error!
What am I missing here?
Can anybody help me Plzz

InfoJunkie4Life
Nov 29, 2014, 08:21 AM
Try here (http://stackoverflow.com/questions/13786192/methods-type-signature-is-not-pinvoke-compatible-while-calling-dll-method). Seems a common problem across the internet.