发信人: jiangsheng()
整理人: zelor(2000-03-15 10:33:16), 站内信件
|
【 在 skyice (浪子) 的大作中提到: 】
: 我有一个类需要在动态链接库中实现,然后在别的地方使用这个类,
: 但我试了几次,都没有成功。有谁能够帮帮我?最好有个例子
///////////////in all h file of DLL A
#ifndef DECLARE_DLL_A
#ifdef IMPLEMENT_DLL_A
#define DECLARE_DLL_A emport(I forgot the symbol)//Only Export in CPP file
#else
#define DECLARE_DLL_A import(I forgot the symbol)
#endif
#endif
class DECLARE_DLL_A CDllClass{
......................
}
extern void DECLARE_DLL_A g_dllFunc();
extern int DECLARE_DLL_A g_nDllData;
///////////////in cpp file
#include .....//other include
#define IMPLEMENT_DLL_A//must define this symbol before include any he ad file in the same dll
#include ......
//your cpp here
void g_dllFunc(){...........}
int g_nDllData;
-- HE WHO CONTROLS THE PAST, COMMANDS THE FUTURE.
HE WHO CONTROLS THE FUTURE CONQUERS THE PAST.
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.44.196]
|
|