Re: [AD] ALLEGRO_NO_ASM broken completely on windows

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


Peter Wang wrote:

I don't think there will be (or should be) another calling convention.

ok :)

Attached a new patch, with some notes in build instructions about #defining ALLEGRO_NO_ASM symbol when building user programs.


--
Milan Mimica
http://sparklet.sf.net
Index: makefile.vc
===================================================================
--- makefile.vc	(revision 9503)
+++ makefile.vc	(working copy)
@@ -41,6 +41,14 @@
    UNIX_TOOLS = 1
 endif
 
+# Choose the calling convenction suffix:
+ifdef ALLEGRO_USE_C
+NO_ASM_SUFFIX = _c
+else
+NO_ASM_SUFFIX =
+endif
+
+
 ifdef STATICRUNTIME
 
 # ======== USING A STATIC RUNTIME (/MT) ========
@@ -49,8 +57,8 @@
 
 # -------- link as a static library --------
 
-OBJ_DIR = obj/msvc/$(VERSION)_s_crt
-IMPLIB_BASENAME = $(VERSION)_s_crt.lib
+OBJ_DIR = obj/msvc/$(VERSION)_s_crt$(NO_ASM_SUFFIX)
+IMPLIB_BASENAME = $(VERSION)_s_crt$(NO_ASM_SUFFIX).lib
 IMPLIB_NAME = lib/msvc/$(IMPLIB_BASENAME)
 LIB_NAME = $(IMPLIB_NAME)
 
@@ -58,10 +66,10 @@
 
 # -------- link as a DLL --------
 
-OBJ_DIR = obj/msvc/$(VERSION)_crt
-DLL_BASENAME = $(VERSION)$(LIBRARY_VERSION)_crt.dll
+OBJ_DIR = obj/msvc/$(VERSION)_crt$(NO_ASM_SUFFIX)
+DLL_BASENAME = $(VERSION)$(LIBRARY_VERSION)_crt$(NO_ASM_SUFFIX).dll
 DLL_NAME = lib/msvc/$(DLL_BASENAME)
-IMPLIB_BASENAME = $(VERSION)_crt.lib
+IMPLIB_BASENAME = $(VERSION)_crt$(NO_ASM_SUFFIX).lib
 IMPLIB_NAME = lib/msvc/$(IMPLIB_BASENAME)
 LIB_NAME = $(DLL_NAME) $(IMPLIB_NAME)
 
@@ -79,8 +87,8 @@
 
 # -------- link as a static library --------
 
-OBJ_DIR = obj/msvc/$(VERSION)_s
-IMPLIB_BASENAME = $(VERSION)_s.lib
+OBJ_DIR = obj/msvc/$(VERSION)_s$(NO_ASM_SUFFIX)
+IMPLIB_BASENAME = $(VERSION)_s$(NO_ASM_SUFFIX).lib
 IMPLIB_NAME = lib/msvc/$(IMPLIB_BASENAME)
 LIB_NAME = $(IMPLIB_NAME)
 
@@ -88,10 +96,10 @@
 
 # -------- link as a DLL --------
 
-OBJ_DIR = obj/msvc/$(VERSION)
-DLL_BASENAME = $(VERSION)$(LIBRARY_VERSION).dll
+OBJ_DIR = obj/msvc/$(VERSION)$(NO_ASM_SUFFIX)
+DLL_BASENAME = $(VERSION)$(LIBRARY_VERSION)$(NO_ASM_SUFFIX).dll
 DLL_NAME = lib/msvc/$(DLL_BASENAME)
-IMPLIB_BASENAME = $(VERSION).lib
+IMPLIB_BASENAME = $(VERSION)$(NO_ASM_SUFFIX).lib
 IMPLIB_NAME = lib/msvc/$(IMPLIB_BASENAME)
 LIB_NAME = $(DLL_NAME) $(IMPLIB_NAME)
 
Index: docs/src/build/mingw32._tx
===================================================================
--- docs/src/build/mingw32._tx	(revision 9503)
+++ docs/src/build/mingw32._tx	(working copy)
@@ -411,6 +411,10 @@
    the statically linked Allegro libraries are post-fixed with '<tt>_s</tt>' so that
    you will link with either <tt>liballeg_s.a</tt>, <tt>liballd_s.a</tt> or <tt>liballp_s.a</tt>.
 
+   When using a no-ASM library (built with <tt>ALLEGRO_USE_C</tt> option), you must define the
+   preprocessor symbol <tt>ALLEGRO_NO_ASM</tt> before including any of the Allegro headers. The
+   names of the no-ASM libraries are post-fixed with '<tt>_c</tt>'.
+
    Don't forget that you need to use the <code>END_OF_MAIN()</code> macro right after
    your <code>main()</code> function.
 
Index: docs/src/build/msvc._tx
===================================================================
--- docs/src/build/msvc._tx	(revision 9503)
+++ docs/src/build/msvc._tx	(working copy)
@@ -253,6 +253,10 @@
       alleg_s_crt.lib - statically linked optimised library 
                            with the static C runtime
 <endblock>
+   All above library configurations could be built with <tt>ALLEGRO_USE_C</tt> option which
+   would add a "_c" suffix to them. When linking your program to such a library, you must define
+   the preprocessor symbol <tt>ALLEGRO_NO_ASM</tt> before including any of the Allegro headers.
+
    When using a statically linked library, you must define the preprocessor
    symbol <tt>ALLEGRO_STATICLINK</tt> before including any of the Allegro headers and
    link your program against Allegro and the main Win32/DirectX libraries
Index: makefile.mgw
===================================================================
--- makefile.mgw	(revision 9503)
+++ makefile.mgw	(working copy)
@@ -35,14 +35,19 @@
    UNIX_TOOLS = 1
 endif
 
+ifdef ALLEGRO_USE_C
+   NO_ASM_SUFFIX = _c
+else
+   NO_ASM_SUFFIX =
+endif
 
 
 ifdef STATICLINK
 
 # -------- link as a static library --------
 
-OBJ_DIR = obj/mingw32/$(VERSION)_s
-IMPLIB_BASENAME = lib$(VERSION)_s.a
+OBJ_DIR = obj/mingw32/$(VERSION)_s$(NO_ASM_SUFFIX)
+IMPLIB_BASENAME = lib$(VERSION)_s$(NO_ASM_SUFFIX).a
 IMPLIB_NAME = lib/mingw32/$(IMPLIB_BASENAME)
 LIB_NAME = $(IMPLIB_NAME)
 
@@ -50,10 +55,10 @@
 
 # -------- link as a DLL --------
 
-OBJ_DIR = obj/mingw32/$(VERSION)
-DLL_BASENAME = $(VERSION)$(LIBRARY_VERSION).dll
+OBJ_DIR = obj/mingw32/$(VERSION)$(NO_ASM_SUFFIX)
+DLL_BASENAME = $(VERSION)$(LIBRARY_VERSION)$(NO_ASM_SUFFIX).dll
 DLL_NAME = lib/mingw32/$(DLL_BASENAME)
-IMPLIB_BASENAME = lib$(VERSION).a
+IMPLIB_BASENAME = lib$(VERSION)$(NO_ASM_SUFFIX).a
 IMPLIB_NAME = lib/mingw32/$(IMPLIB_BASENAME)
 LIB_NAME = $(DLL_NAME) $(IMPLIB_NAME)
 EXPDEF_NAME = lib/mingw32/allegro.def
Index: makefile.all
===================================================================
--- makefile.all	(revision 9503)
+++ makefile.all	(working copy)
@@ -15,7 +15,7 @@
 #                           to *NOT* be backwards compatible (GCC-based platforms, MSVC).
 #        TARGET_OPTS        allows you to customize general optimizations (GCC-based platforms).
 #        CROSSCOMPILE=1     cross-build under Linux (DJGPP, MinGW32).
-#        ALLEGRO_USE_C=1    use C drawing code instead of asm (GCC-based platforms).
+#        ALLEGRO_USE_C=1    use C drawing code instead of asm (GCC-based platforms, MSVC).
 #        UNIX_TOOLS=1       use Unix-like tools instead of DOS tools.
 #
 #     Targets: 


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