比如有个C++类,它的定义如下:
class Cat // begin declaration of the class
{
public: // begin public section
int GetAge(); // accessor function
void SetAge (int age); // accessor function
void Meow(); // general function
private: // begin private section
int itsAge; // member variable
};并已经实现了这个类,而且生成了Cat.dll那么我在C#里如何生产一个Cat实例呢谢谢
class Cat // begin declaration of the class
{
public: // begin public section
int GetAge(); // accessor function
void SetAge (int age); // accessor function
void Meow(); // general function
private: // begin private section
int itsAge; // member variable
};并已经实现了这个类,而且生成了Cat.dll那么我在C#里如何生产一个Cat实例呢谢谢
做成动态链接库,就用 dllimport 的方式使用。
怎么用dllimport 的方法来定义这个类。
dllimport 好像这能作用于函数
public class Win32 {
[DllImport("User32.Dll")]
public static extern void SetWindowText(int h, String s);
}