ACE安装与配置

ACE (the ADAPTIVE—A Dynamically Assembled Protocol Transformation, Integration, and eValuation
Environment—Communication Environment),很早就知道是个好东东,就是懒得去研究,现在由于工作需要,
终于有机会亲自体验它的魅力了。希望与更多的人交流学习心得,共同进步。

感谢网友汪海龙无私地提供以下电子文档:
1.《ACE Programmer's Guide, The: Practical Design Patterns for Network and Systems Programming》
By Stephen D. Huston, James CE Johnson, Umar Syyid
Publisher : Addison Wesley
Pub Date : November 14, 2003
ISBN : 0-201-69971-0
Pages : 544

2.《C++ Network Programming Volume 1 Mastering Complexity with ACE and Patterns 》
By Douglas. Schmidt, Stephen D. Huston
Pages : 293

3.《C++ Network Programming Volume 1 Mastering Complexity with ACE and Patterns 》
By Douglas C. Schmidt, Stephen D. Huston
Publisher : Addison Wesley
Pub Date : October 29, 2002
ISBN : 0-201-79525-6
Pages : 384

如果要阅读源码,最好结合那个用Doxygen生成的文档,从ftp://ace.cs.wustl.edu/pub/ACE/下载即可。

如果讨厌看E文,可以访问以下网址查看中译文:http://www.flyingdonkey.com/ace/ ,顺便向作者致敬。


一. Windows下for MSVC的安装与配置

我们用的是ACE-5.4+TAO-1.4+CIAO-0.4.zip,Windows下解压缩该压缩包到目标路径(设为D:\ACE_wrappers ),

创建文件:$ACE_ROOT/ace/config.h,增加一行:
#include "ace/config-win32.h"

如果是在Windows 9x/Me下,需要在$ACE_ROOT/ace/config.h中#include语句前加入:
#define ACE_HAS_WINNT4 0

如果想使用standard C++ header,需要在$ACE_ROOT/ace/config.h中#include语句前加入:
#define ACE_HAS_STANDARD_CPP_LIBRARY 1

如果想把MFC作为静态库链接到ACE(If you prefer to link MFC as a static library into ACE),
则需要在$ACE_ROOT/ace/config.h中#include语句前加入:
#define ACE_HAS_MFC 1

如果想生成ACE静态库或在工程中使用ACE静态库,都需要定义以下宏:
ACE_AS_STATIC_LIBS


打开工程,D:\ACE_wrappers\ace.dsw,编译生成以下库:

ace.dll/ace.lib (DLL release)
aced.dll/aced.lib(DLL debug)
acemfc.dll/acemfc.lib (MFC DLL release)
acemfcd.dll/acemfcd.lib(MFC DLL debug)

aces.lib  (Static library release)
acesd.lib (Static library debug)

这些库可分别实现了Debug/Release, MFC/Non-MFC, Static/Dynamic library.

其中前四个的dll在D:\ACE_WRAPPERS\bin目录下, 所有对应的.lib库文件在D:\ACE_WRAPPERS\ace下。

ACE是网络通讯中间件,如果机器没有装网卡,就仿真一个,比如可以从控制面板选装MS Loopback Adapter。

接下来我们创建一个新的工程,如果机器上装了不同版本的ACE,需要针对某个版本配置,方法如下:

1. 配置C/C++ tab

(1) Code Generation category中应选择合适的选项:
Multithreaded和Multithreaded DLL是for Release版的
Debug Multithreaded和Debug Multithreaded DLL是for Debug版的

(2) $(ACE_ROOT)路径的配置:
如果需要针对不同版本ACE灵活配置的话,则需要设置Preprocessor category中"Additional include directories"
这一项,指明特定版本ACE所在的路径,比如D:\ACE_wrappers

2. 链接到特定版本的ACE库。

(1) 在Project/Setting/Link的Input category下 "Additional library path"中增加特定版本的ACE库文件路径,
比如D:\ACE_wrappers\ace,然后将D:\ACE_wrappers\bin目录下对应的dll拷贝到工程文件所在路径下,或者在环境
变量PATH中加入D:\ACE_wrappers\bin。

(2) 在Project/Setting/Link的Input category下"Object/library modules" 中指定需要包含的ACE库(*.lib)


如果只装了一个ACE,可采用对所有工程都生效的缺省配置,方法如下:

1. 添加环境变量:
ACE_ROOT:  D:\ACE_wrappers
PATH 中加入:D:\ACE_wrappers\bin

2. 设置VS的路径:
Include files包含:D:\ACE_wrappers
library files包含:D:\ACE_wrappers\ace

此后,就可以在工程中指定需要包含的ACE库(*.lib)后正常使用了。


二. Linux下的安装与配置
1.安装
 以用户aceuser为例
 (1)下载ACE-5.4+TAO-1.4+CIAO-0.4.tar.gz(其它版本的也一样)


 (2)解压之
    #cd /home/aceuser/ace
    #tar -xzvf  ACE-5.4+TAO-1.4+CIAO-0.4.tar.gz

 (3)
  #vi /home/aceuser/.bashrc
  加入下面两行:
  export ACE_ROOT=/home/aceuser/ace/ACE_wrappers
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACE_ROOT/ace
  
  并使这些环境变量生效(运行source 或者重新登陆)。

 (4)
  
  #cd /home/aceuser/ace/ACE_wrappers/ace/
  #cp ./config-linux.h ./config.h
  #cd ../include/makeinclude/
  #ln -s ./platform_linux.GNU ./platform_macros.GNU

 (5)编译
  #cd /home/aceuser/ace/ACE_wrappers/ace/
  #make
  对于ACE-5.4+TAO-1.4+CIAO-0.4这个版本,不能ACE-5.4+TAO-1.4+CIAO-0.4.zip这个压缩包,否则会出现如下错误:
  ln -s libACE.so.5.4.0 libACE.so
  chmod a+rx libACE.so.5..0
  : command not foundpers/bin/ace_components: line 10
  '/home/aceuser/ace/ACE_wrappers/bin/ace_components: line 31: syntax error near unexpected token 'in
  '/home/aceuser/ace/ACE_wrappers/bin/ace_components: line 31: ' case $1 in
  make[1]: ***[ACE_COMONENTS] Error 2
  make[1]: Leaving directory '/home/aceuser/ace/ACE_wrappers/ace'
  make: ***[all] Error 2 
  如果换成ACE-5.4+TAO-1.4+CIAO-0.4.tar.gz就没有任何问题了

  编译时也可以根据自己的需要设置编译选项
  #make [options]
  下面是option的描述:
 Option         Description 
 debug=1|0   Enable or disable debugging in the built library or program. Default is enabled (1). 
 optimize=1|0   Turn compiler optimization on or off. Default is off (0). 
 buildbits=bits   Explicitly select, for example, 32-bit or 64-bit build target. Default is the compiler's default for the build machine. This option works for AIX, Solaris, and HP-UX.
 exceptions=1|0  Enable or disable exception handling. Default is platform specific but usually enabled (1).
  inline=1|0   Enable or disable inlining of many of ACE's methods. Default is platform specific but usually enabled (1).
 templates=model  Specify how templates are instantiated. Most common values for model are automatic, the default for compilers that support it well, and explicit, requiring source code directives to explicitly instantiate needed templates (see Section 1.6.1).
  static_libs=1|0  Build and use static libraries. Default is to not build static libraries (0).
 
2.使用
下面介绍如何从零开始建立一个使用ACE的工程。并使之run起来

 (1)编写使用了ACE的代码
 (2)编写Makefile
 
 BIN = hello_ace
 FILES = Piece2 Piece3
 SRC= $(addsuffix .cpp,$(FILES))
 OBJ= $(addsuffix .o,$(FILES))
 BUILD   = $(VBIN)
 #---------------------------------------------------------
 # Include macros and targets
 #---------------------------------------------------------
 include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
 include $(ACE_ROOT)/include/makeinclude/macros.GNU
 include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
 include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
 include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
 include $(ACE_ROOT)/include/makeinclude/rules.local.GNU

以上的Makefile包含3个cpp文件hello_ace.cpp、Piece2.cpp和Piece3.cpp

 (3)编译
   #make
  如果程序没有任何问题,现在程序应该就可以运行了。


转载于:https://www.cnblogs.com/crazyly/archive/2011/02/14/ACE.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ACE程序员指南 [ Team LiB ] • Table of Contents ACE Programmer's Guide, The: Practical Design Patterns for Network and Systems Programming By Stephen D. Huston, James CE Johnson, Umar Syyid Publisher : Addison Wesley Pub Date : November 14, 2003 ISBN : 0-201-69971-0 Pages : 544 "If you're designing software and systems that must be portable, flexible, extensible, predictable, reliable, and affordable, this book and the ACE toolkit will enable you to be more effective in all of these areas. Even after spending over a decade developing ACE and using it to build networked software applications, I find that I've learned a great deal from this book, and I'm confident that you will, too." -Douglas C. Schmidt, Inventor of ACE, from the Foreword "This book is a must-have for every ACE programmer. For the beginner, it explains step-by-step how to start using ACE. For the more experienced programmer, it explains in detail the features used daily, and is a perfect reference manual. It would have saved me a lot of time if this book had been available some years ago"! -Johnny Willemsen, Senior Software Engineer, Remedy IT, The Netherlands "With a large C++ code base, we rely on ACE to enable a cross-platform client-server framework for data quality and data integration. ACE has improved our design and smoothed over OS idiosyncrasies without sacrificing performance or flexibility. The combination of online reference materials and printed "big picture" guides is indispensable for us, and The ACE Programmer's Guide earns top-shelf status in my office." -John Lilley, Chief Scientist, DataLever Corporation "In SITA air-ground division, we are one of the major suppliers of communication services to the airline industry. We started using ACE about a year ago and are now moving most of our new communication-related development to it. I can say that using this toolkit can reduce the development and testing time by at least 50% in our type of application". -Jean Millo, Senior Architect, SITA The ADAPTIVE Communication Environment (ACE) is an open-source software toolkit created to solve network programming challenges. Written in C++, with the help of 30 core developers and 1,700 contributors, this portable middleware has evolved to encapsulate and augment a wide range of native OS capabilities essential to support performance-driven software systems. The ACE Programmer's Guide is a practical, hands-on guide to ACE for C++ programmers building networked applications and next-generation middleware. The book first introduces ACE to beginners. It then explains how you can tap design patterns, frameworks, and ACE to produce effective, easily maintained software systems with less time and effort. The book features discussions of programming aids, interprocess communication (IPC) issues, process and thread management, shared memory, the ACE Service Configurator framework, timer management classes, the ACE Naming Service, and more. [ Team LiB ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值