Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > by-pkgid > 56c615211d295fb99ff45dd87fd8e366 > files > 248

lib64allegro-devel-4.2.2-4mdv2009.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>
Allegro DMC-specific information
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" title="Default" type="text/css" href="../allegro.css"></head><body bgcolor=white text=black link="#0000ee" alink="#ff0000" vlink="#551a8b">
<pre>
     ______   ___    ___
    /\  _  \ /\_ \  /\_ \
    \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___ 
     \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ <tt>`\/\`'</tt>__\/ __`\
      \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
       \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
        \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
                                       /\____/
                                       \_/__/


                 DMC-specific information.

         See <a href="../readme.html">readme.txt</a> for a more general overview.
</pre>



<p><br>
<h1><a name="DMC notes">DMC notes</a></h1>

<p>
   Status: complete.
   
<p>
   Caveats: The DMC port does not support assembly, so ALLEGRO_USE_C must be
   set when compiling. The DMC runtime library does not support unicode paths.
      
<p>
   DMC is the only Windows compiler that can build a static library that can
   be used with DAllegro.
   
<p>
   The instructions at <a href="http://wiki.allegro.cc/Build/DMC">http://wiki.allegro.cc/Build/DMC</a> might be 
   more up to date.



<p><br>
<h1><a name="Required software">Required software</a></h1>

<p>
   <ul><li>Digital Mars C/C++ Compiler - <a href="http://www.digitalmars.com/d/1.0/download.html">http://www.digitalmars.com/d/1.0/download.html</a>
   <li>Digital Mars Basic Utilities - <a href="http://ftp.digitalmars.com/bup.zip">http://ftp.digitalmars.com/bup.zip</a>
   <li>GNU Make - <a href="http://sourceforge.net/project/showfiles.php?group_id=9328">http://sourceforge.net/project/showfiles.php?group_id=9328</a>
   <li>Recent set of DirectX and other Windows SDK headers. - <a href="http://alleg.sourceforge.net/files/dx70_dmc.zip">http://alleg.sourceforge.net/files/dx70_dmc.zip</a>
   </ul>



<p><br>
<h1><a name="Setting up DMC">Setting up DMC</a></h1>

<p>
   <ol><li>Unzip the Digital Mars compiler (dmc.zip) and place the files in c:\dmc.
   <li>Unzip the Basic Utilities (bup.zip) and place them in the same folder.
   (The exe files should all be in the c:\dmc\bin folder.)
   <li>Unzip the DirectX 7 package (dx70_dmc.zip) and place the include files
   in c:\dmc\include and the library files in c:\dmc\lib. (This will overwrite
   some of DMC's default DX files.)
   <li>Extract only the usr/local/wbin/make.exe file from UnxUtils.zip to your
   desktop, rename it to gmake.exe, and copy it to c:\dmc\bin.
   <li>Add c:\dmc\bin to your PATH environment variable.
   <li>Create the DMCDIR environment variable and set it to c:\dmc
   </ol>



<p><br>
<h1><a name="Building Allegro">Building Allegro</a></h1>

<p>
<br><center><h2><a name="Step by Step Instructions">Step by Step Instructions</a></h2></center><p>

<p>
   <ul><li>Extract the Allegro source zip file to c:\allegro
   <li>Open up a MS-DOS prompt and type the following commands.
   </ul>   
<blockquote class="text"><pre>
   cd\allegro   
   fix dmc   
   gmake obj\dmc\plugins.h
   gmake all ALLEGRO_USE_C=1 STATICLINK=1
   gmake installall ALLEGRO_USE_C=1 STATICLINK=1
   gmake all ALLEGRO_USE_C=1
   gmake installall ALLEGRO_USE_C=1
</pre></blockquote>
   
<p>
<br><center><h2><a name="Advanced Build Options">Advanced Build Options</a></h2></center><p>

<p>
   The above instructions build six versions of Allegro, the Demo, tools,
   examples, and the documentation. If you don't need all of that, you can
   customize what gets built. Obviously, if you don't need both the static or
   dynamic libraries, simply don't run the associated commands. If you don't
   care about the Debugging or Profiling versions, you can remove the word all
   from the command line. For example:

<blockquote class="text"><pre>
   gmake ALLEGRO_USE_C=1
   gmake install ALLEGRO_USE_C=1
</pre></blockquote>

<p>
   builds and installs the optimized, dynamic Allegro library along with all of
   the examples, documents, etc. Or if you want to specifically build and
   install the debug and profiling versions:

<blockquote class="text"><pre>
   gmake ALLEGRO_USE_C=1 DEBUGMODE=1
   gmake install ALLEGRO_USE_C=1 DEBUGMODE=1
   gmake ALLEGRO_USE_C=1 PROFILEMODE=1
   gmake install ALLEGRO_USE_C=1 PROFILEMODE=1
</pre></blockquote>

<p>
   If you only want to build the library (without the extra stuff), specifically
   request to make the lib target:

<blockquote class="text"><pre>
   gmake lib ALLEGRO_USE_C=1
</pre></blockquote>

<p>
   That would only build the optimized, dynamic Allegro library. Other targets
   besides lib exist; refer to Makefile.all and Makefile.dmc for more
   information. All of the options can be mixed and matched where it makes
   sense.

<p>
   Note that DMC can only build the C version of Allegro (as opposed to using
   some assembly), so the ALLEGRO_USE_C=1 option is mandatory. 



<p><br>
<h1><a name="Using Allegro">Using Allegro</a></h1>

<p>
<br><center><h2><a name="Hello World">Hello World</a></h2></center><p>

<p>
   For a simple example, consider hello.c:

<blockquote class="code"><pre>
   #include &lt;allegro.h>

   int main(void)
   {
           allegro_init();
           set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0,0);
           allegro_message("Hello, World!");
           return 0;
   }
   END_OF_MAIN()
</pre></blockquote>

<p>
   First, you must include the Allegro header file. Inside the main function,
   you should call allegro_init() to set up Allegro. You must do that before
   calling (almost) any of the other Allegro functions. (This program will
   create a 640x480 window and then pop-up the message "Hello, World!".)
   At the end of the main function, you must include the END_OF_MAIN() 
   macro (no semicolon is needed).

<p>
<br><center><h2><a name="Dynamic Version (DLL)">Dynamic Version (DLL)</a></h2></center><p>

<p>
   To compile this program, type:

<blockquote class="text"><pre>
   dmc -c test.c
</pre></blockquote>

<p>
   This will create the object file. It will then need to be linked to Allegro
   when you create the executable:

<blockquote class="text"><pre>
   dmc test.obj alleg.lib -otest.exe
</pre></blockquote>

<p>
   That will build test.exe, which will require the Allegro DLL (eg: alleg42.dll)
   to run. Alternatively you could use allp.lib for profiling or alld.lib for
   debugging.
   
<p>
<br><center><h2><a name="Static Version">Static Version</a></h2></center><p>

<p>
   If you wanted to statically link this program so that the Allegro DLL is not
   required, you must first compile it like:

<blockquote class="text"><pre>
   dmc -c test.c -DALLEGRO_STATICLINK=1
</pre></blockquote>

<p>
   Then you can link it against any of the static versions of Allegro:

<blockquote class="text"><pre>
   dmc test.obj alleg_s.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
      ole32.lib dinput.lib ddraw.lib winmm.lib dsound.lib dxguid.lib
</pre></blockquote>

<p>
(All of that should be entered on one line.) Note that you have to include a
bunch of Windows libraries when you statically link! As before, you can also
use allp_s.lib for profiling and alld_s.lib for debugging. 



</body>
</html>