i want to use c++ function code into .net code
MYDLL_API BOOL GetFolderSize(LPCTSTR lpszStartFolder,
BOOL bRecurse,
BOOL bQuickSize,
PLARGE_INTEGER lpFolderSize,
LPDWORD lpFolderCount /*= NULL*/,
LPDWORD lpFileCount /*= NULL*/);
so i create dll to export the code then use PInvoke in c# code
[StructLayout(LayoutKind.Explicit, Size = 8)]
struct LARGE_INTEGER
{
[FieldOffset(0)]
public Int64 QuadPart;
[FieldOffset(0)]
public UInt32 LowPart;
[FieldOffset(4)]
public Int32 HighPart;
}
[DllImport("mydll.dll")]
extern static bool GetFolderSize(string lpszStartFolder,
bool bRecurse,
bool bQuickSize,
out LARGE_INTEGER lpFolderSize,
out UInt32 lpFolderCount,
out UInt32 lpFileCount);
what the wrong in that????
but when i call it it give me run time exception A call to PInvoke function 'dublication!dublication.Form1::GetFolderSize' 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