我正在做CLR包装器。它成功构建。问题是,当我在c#project RegisterMessageCallback
方法中引用包装器.dll时,完全没有。以下是我在元数据中看到的内容:
public class ATFeedWrapper : IDisposable
{
public ATFeedWrapper();
public sealed override void Dispose();
public void Login();
protected virtual void Dispose(bool A_0);
}
这是包装类.h:
public ref class ATFeedWrapper
{
public:
ATFeedWrapper();
void Login();
void RegisterMessageCallback(void(*clbck)(string));
~ATFeedWrapper();
private:
ATFeedClient* client;
};
和.cpp:
ATFeedWrapper::ATFeedWrapper()
{
client = new ATFeedClient();
}
void ATFeedWrapper::Login()
{
client->Login();
}
void ATFeedWrapper::RegisterMessageCallback(void(*clbck)(string))
{
client->RegisterMessageCallback(*clbck);
}
ATFeedWrapper::~ATFeedWrapper()
{
delete client;
}
发生了什么?为什么会丢失?