开发者

Error in my calling Function

this is my code

public delegate void NotifyFunc(enumType notificationType, IntPtr data); 

[DllImport("VssSdkd")] 
public static extern void startVssSdkClientEcho(string IpAddress, 
    long port, NotifyFunc notifyFunc, eProtocolType proType, bool Req); 

am call the function like

CallBack calbck = new CallBack(TestDllImport.Callbackas);

开发者_JAVA技巧startVssSdkClientEcho("192.168.10.240", 12050, calbck, TestDllImport.eProtocolType.eProtocolType_VssSdk, false);

here my receving callback function is

static public void Callbackas(eNotificationType type, IntPtr datas) {}

here first time am receving data and then it's giving Error msg like :

run time check failure #0 - the value if ESP was not properly saved across a function call.
 this is usually a result of calling a function declared with one calling convention 
with a function pointer declared with a different calling convention 

please help me to identify my error... thanks in advance


Is this your code you are calling (sorry cursory search could only find your other post referring to startVssSdkClientEcho). Is it decalred cdecl (i.e. it has no __declspec at all) or is it stdcall. If it is cdecl you need to add CallingConvention attribute to the DllImport

i.e.

[DllImport("VssSdkd", CallingConvention=CallingConvention.Cdecl)]

Of course it might also be the callback calling convention at fault which is another issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜