|
楼主 |
发表于 2007-12-18 23:38:18
|
显示全部楼层
最省事的做法是通过 MPC
下面是我的一个示例
- // -*- MPC -*- now wouldn't this be cool...
- // ServiceFactory.mpc,v 1.0 2006/08/01 tbergmann Exp
- // 大厅服务
- project(LobbyService) : acelib{
- sharedname = LobbyService
- dynamicflags += ACE_BUILD_SVC_DLL ACEXML_HAS_DLL ACEXML_PARSER_HAS_DLL
- dllout = $(BABY_ROOT)/lib
- libout = $(BABY_ROOT)/lib
- includes += $(BABY_ROOT)/ServiceFactory
- libpaths += $(BABY_ROOT)/lib
- libs += ServiceFactory ACEXML ACEXML_Parser
-
- Source_Files {
- LobbyServiceFactory.cpp
- OptionsHandler.cpp
- GameClient.cpp
- }
- Header_Files {
- LobbyServiceFactory.h
- OptionsHandler.h
- GameClient.h
- }
- }
复制代码
下面是一个头函数的声明
- //@file: GameClient.h
- //@date: 2007-1-26
- //@author: Stone Jiang<[email]2005119@gmail.com[/email]>
- #ifndef GAME_CLIENT_H_20070126
- #define GAME_CLIENT_H_20070126
- #include "ace/svc_export.h"
- #include "LobbyServiceFactory.h" //User_T
- class ACE_Svc_Export GameClient_T: public ClientHandler_T
- {
- public:
- GameClient_T(void* arg = 0);
- virtual ~GameClient_T();
- // 处理UDP请求
- virtual int processUDPRequest(ACE_Message_Block* mb,
- const ACE_INET_Addr&remoteAddr);
-
- //处理客户端登录
- virtual int login(const char* name, const char* password);
- public:
- User_T user_;
- public:
- //for debug only
- virtual int process();
- };
- #endif
复制代码
ACE_Svc_Export 的定义在 "ace/svc_export.h" 中.
当然你也可以通过 generate_export_file.pl 生成一个你自己的 export文件.
更进一步的细节,可以看一下
C++ Language Reference
dllexport, dllimport |
|