⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cdll.cpp

📁 《Delphi开发人员指南》配书原码
💻 CPP
字号:
#include <windows.h>

// objects
class TFoo
{
  virtual int function1(char *);
  virtual int function2(int);
};

//member functions
int TFoo::function1(char * str1)
{
  MessageBox(NULL, str1, "Hello from C++ DLL", MB_OK);
  return 0;
}

int TFoo::function2(int i)
{
  return i * i;
}

#ifdef __cplusplus
extern "C"  {
#endif

//prototypes                
TFoo * __declspec(dllexport) ClassFactory(void);
void __declspec(dllexport) ClassKill(TFoo *);

TFoo * __declspec(dllexport) CLASSFACTORY(void)
{
  TFoo * Foo;
  Foo = new TFoo;
  return Foo;
}

void __declspec(dllexport) CLASSKILL(TFoo * Foo)
{
  delete Foo;
}

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
	return 1;
}

#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -