Building and Installing ACE on Windows with Microsoft Visual C++

来源:互联网 发布:华为网络技术学院 编辑:程序博客网 时间:2024/05/19 23:57

Building and Installing ACE on Windows with Microsoft Visual C++

  1. Uncompress the ACE distribution into a directory, where it will create a ACE_wrappers directory containing the distribution. The ACE_wrappers directory will be referred to as ACE_ROOT in the following steps -- so ACE_ROOT\ace would be C:\ACE_wrappers\ace if you uncompressed into the root directory.

  2. Create a file called config.h in the ACE_ROOT\ace directory that contains: 

    #include "ace/config-win32.h"

  3. The static, DLL and MFC library builds are kept in different workspaces. Files with names *_Static contain project files for static builds. Workspaces for static and DLL builds will be available through the stock release at DOC group's website. The workspaces for MFC are not available and have to be generated using MPC. Please see MPC's README for details.

  4. Now load the workspace file for ACE (ACE_ROOT/ACE.dsw).

  5. Make sure you are building the configuration (i.e, Debug/Release) the one you'll use (for example, the debug tests need the debug version of ACE, and so on). All these different configurations are provided for your convenience. You can either adopt the scheme to build your applications with different configurations, or use ace/config.h to tweak with the default settings on NT.
    Note: If you use the dynamic libraries, make sure you include ACE_ROOT\lib in your PATH whenever you run programs that uses ACE. Otherwise you may experience problems finding ace.dll or aced.dll.

  6. If you are building for Windows NT 4 or later (Windows 2000, XP, etc.) then you can start building without anymore changes. If you are building on Windows 9x/Me, then you should add the line

    #define ACE_HAS_WINNT4 0

    before the #include statement in ACE_ROOT\ace\config.h and it will turn off some WinNT/Win2K-specific code in ACE.

  7. If you want to use the standard C++ headers (iostream, cstdio, ... as defined by the C++ Standard Draft 2) that comes with MSVC, then add the line: 

    #define ACE_HAS_STANDARD_CPP_LIBRARY 1

    before the #include statement in ACE_ROOT\ace\config.h.

  8. To use ACE with MFC libraries, also add the following to your config.h file. Notice that if you want to spawn a new thread with CWinThread, make sure you spawn the thread with THR_USE_AFX flag set.

    #define ACE_HAS_MFC 1

    By default, all of the ACE projects use the DLL versions of the MSVC run-time libraries. You can still choose use the static (LIB) versions of ACE libraries regardless of run-time libraries. The reason we chose to link only the dynamic run-time library is that almost every NT box has these library installed and to save disk space. If you prefer to link MFC as a static library into ACE, you can do this by defining ACE_USES_STATIC_MFC in your config.h file. However, if you would like to link everything (including the MSVC run-time libraries) statically, you'll need to modify the project files in ACE yourself.

  9. Static version of ACE libraries are built with ACE_AS_STATIC_LIBS
    defined. This macro should also be used in application projects that link to static ACE libraries

    Optionally you can also add the line 

    #define ACE_NO_INLINE

    before the #include statement in ACE_ROOT\ace\config.h to disable inline function and reduce the size of static libraries (and your executables.)

  10. ACE DLL and LIB naming scheme:

    We use the following rules to name the DLL and LIB files in ACE when using MSVC.

    "Library/DLL name" + (Is static library ? "s" : "") + (Is Debugging enable ? "d" : "") + {".dll"|".lib"}

More information for ACE/TAO on MSVC can be found here. The doxygen version of this document is available under Related Topics in the ACE Library.

ACE TESTS

The tests are located in ACE_ROOT\tests. There is also a workspace in that directory to build all the tests (tests.dsw)

Once you build all the tests (Batch Build works well for this), you can run perl script run_test.pl in the tests directory to try all the tests.

BUILDING ACE ON A WIN32 MACHINE THAT LACKS A NETWORK CARD

You may want to run ACE on a non-networked machine. To do so, you must install TCP/IP and configure it to ignore the absence of a network card. This is one method:

  1. Run Control Panel
  2. Choose Network from Control Panel
  3. Add Adapter: MS Loopback Adapter
  4. Configure MS Loopback Adapter with 802.3 (default)
  5. Add Protocol: TCP/IP Protocol
  6. Configure TCP/IP Protocol with a valid IP address and subnet mask. Leave everything else at the default settings.
  7. Add Service: Workstation
  8. Exit and Restart System
  9. Run Control Panel again
  10. Choose Services from Control Panel
  11. The following services are not necessary and may be set to Disabled Startup: 
    Alerter
    Computer Browser
    Net logon
    Messanger
  12. Choose Network from Control Panel
  13. Confirm the following setup. This is all you need to run ACE:
    Installed Software:
    Computer Browser
    MS Loopback Adapter Driver
    TCP/IP Protocol
    Workstation
    Installed Adapter Cards:
    MS Loopback Adapter

WIN32 ALPHA CONFIGURATIONS

The project files for Visual C++ no longer contain any configurations targetted to Windows NT on the DEC Alpha. Below are the steps needed to recreate the Alpha configurations:

  1. Load the project on the Alpha machine.
  2. Go to the Build menu and then select Configurations.
  3. Select the project that you want to convert.
  4. Click on Add.
  5. Select the x86 configuration to "Copy settings from" (either Debug or Release versions).
  6. Prepend "Alpha " to the beginning of the name under "Configuration".
  7. Click OK.
  8. Close the "Configurations" window.
  9. Now go to the Project settings.
  10. For the General Settings, change the output directories to standard ACE output directories. Intermediate Directories are "Debug" and "Release" in most cases. The Output Directories are blank, except for Release versions of executables, in which it is also "Release".
  11. For the C/C++ Settings, make sure that the Code Generation's runtime library is set to "Multithreaded DLL" or "Debug Multithreaded DLL".

Note: MSVC 6 has a bug where if a .dsp is converted from version 5 to 6 on x86, the Alpha configuration can get corrupted. This seems to happen when additional include or library directories are specified using backslashes instead of forward slashes. If this occurs, the easiest way to fix it is to recreate it.


原创粉丝点击