Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Compiled Languages (https://www.askmehelpdesk.com/forumdisplay.php?f=466)
-   -   C# - Method's type signature is not PInvoke compatible (https://www.askmehelpdesk.com/showthread.php?t=805246)

  • Nov 29, 2014, 04:55 AM
    Gopi Chand
    C# - Method's type signature is not PInvoke compatible
    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
  • Nov 29, 2014, 08:21 AM
    InfoJunkie4Life
    Try here. Seems a common problem across the internet.

  • All times are GMT -7. The time now is 07:38 PM.