[英]CallBack function from c# to c++
I have a C# exe and some vc++ dll's . 我有一个C#exe和一些vc ++ dll。 I am creating a callBackFunction in C# whichh takes structure as its Parameters.
我正在C#中创建一个以结构为参数的callBackFunction。 My c++ dll will fill this structure and return it back.But 95% of the time My Exe crashes.
我的c ++ dll将填充此结构并将其返回。但是95%的时间我的Exe崩溃。 My dll is multi threaded and my C# has backgroundWorker in it.
我的dll是多线程的,我的C#中有backgroundWorker。 I have put try catch block to check if any exceptions are coming or not but no exception is being caught.
我已经尝试try catch块来检查是否有任何异常发生,但是没有异常被捕获。 Can any one suggest a better way to send data from my vc++ dll to c# exe
任何人都可以建议一种更好的方式将数据从我的vc ++ dll发送到c#exe
this must work: 这必须工作:
(c#) (C#)
namespace Test
{
public class CallbackClass
{
public void Callback(string s)
{
MessageBox.Show(s);
}
}
}
(c++/cli) (c ++ / cli)
...
Test::CallbackClass::Callback(gcnew System::String("woof!");
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.