Search Results

Search found 1 results on 1 pages for 'cristic'.

Page 1/1 | 1 

  • Problem invoking C DLL in C#

    - by CristiC
    I'm currently trying to invoke a method made in C from C# C code looks like this: extern "C" int addSum(int a, int b) { return a*b; } extern "C" int getCount() { return 12; } and C# code looks like this: [DllImport("mydll.dll", SetLastError=true)] private static extern int addSum(IntPtr a, IntPtr b); [DllImport("mydll.dll", SetLastError = true)] private static extern int getCount(); public static int mySum(int a, int b) { return suma(a, b); } public static int getMyCount() { return getCount(); } The code returns the right values but i'm getting the following error: addSum' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature. Any sugestion regarding this issue ? Thanks

    Read the article

1