[AD] Solution to compiling ACE networking and Allegro on Windows.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


A few months ago, I emailed I was having a problem getting the ACE network library compiling properly with Allegro on a Windows platform.  ACE and Allegro worked well on Linux and MAC OS X, but, not on Windows which forced me to implement an alternate winsock implementation specifically for my Windows Allegro application.

 

I recently finally figured out how to get the two to compile and work together on Windows and thought I would share the solution to all here in the event someone else decides to do a cross-platform networked game.

 

1. When creating your Windows Allegro project, you have to build with the following compiler preprocessor defines for both Debug and Release build targets:

 

      ALLEGRO_NO_MAGIC_MAIN

      WIN32_LEAN_AND_MEAN

 

2. Additionally you have to define the following preprocessor define when building for a Release target.  This solves a thread compiling problem with ACE. 

 

      _WIN32_WINNT=0x0400

 

3. Supply a WinMain function as your program starting point rather than a main().

     

      int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )

      {

            // your normal main() code

      }

     

4.  You do not specify an END_OF_MAIN() macro at the end of your WinMain() code.

 

5. For cross-platform compiling, simply surround your WinMain with #if defined WIN32 and your usual END_OF_MAIN() macro with #if !defined ALLEGRO_NO_MAGIC_MAIN.

 

If you are interested in adding cross-platform network capability to your program, you can check out the ACE library here. 

 

http://www.cs.wustl.edu/~schmidt/ACE.html

 

 

I can verify that it works well on Windows, Linux and MAC OS X.  The library also comes with other nifty cross-platform tools that might interest you such as a portable hash map implementation, SSL connections and portable threading interface among many other things.

 

If you are new to networking, there is an 'ok' book to get your started with ACE specifically which I personally used for getting started.  It covers basic network concepts and how you can implement your own networking applications with decent examples specifically using ACE.  I already had a pretty good grasp of general networking so I simply wanted the book to read about how to use ACE for my application.  I'm not sure how good this book is for someone completely new to network programming.

 

http://www.cs.wustl.edu/~schmidt/ACE/book1/

 

 

I have to warn that ACE is much more than a simple portable network interface.  It comes with very high level frameworks called TAO and CIAO that are intended to be used to completely abstract away network programming for large applications.  Hence why I only give the book mentioned above ass 'ok'.  The book quickly goes from basic networking and implementation to building applications with TAO and CIAO which I personally had no need for.

 

With that said, the basic ACE libraries are good at handling the typical network nitty gritty one would deal with when creating a basic network sockets application.  Don't get lost in the TAO and CIAO stuff. :)

 

Hope this was useful to someone.

 

 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/