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
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