[AD] allegro and MSVC (single-threaded, multithreaded and multithreaded dll)

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


Hi, as you may know, Mingw32 can only compile using MSVCRT.DLL (that
is in MSVC called "using Multithreaded DLL C library)

but MSVC has 3 options to compile for

single-threaded (/ML)
"Causes the compiler to place the library name LIBC.LIB into the .OBJ file
so that the linker will use LIBC.LIB to resolve external symbols. This is
the compiler's default action. LIBC.LIB does not provide multithread
support."

multi-threaded (/MT)
"Defines _MT so that multithread-specific versions of the run-time routines
are selected from the standard header (.H) files. This option also causes
the compiler to place the library name LIBCMT.LIB into the .OBJ file so that
the linker will use LIBCMT.LIB to resolve external symbols. Either /MT or
/MD (or their debug equivalents /MTd or /MDd) is required to create
multithreaded programs."

and multi-threaded dll (/MD)
"Defines _MT and _DLL so that both multithread- and DLL-specific versions of
the run-time routines are selected from the standard .H files. This option
also causes the compiler to place the library name MSVCRT.LIB into the .OBJ
file.
Applications compiled with this option are statically linked to MSVCRT.LIB.
This library provides a layer of code that allows the linker to resolve
external references. The actual working code is contained in MSVCRT.DLL,
which must be available at run time to applications linked with MSVCRT.LIB."

ok, what i wanted to say is that a same program (no matter is using a DLL or
an static linked module) cannot work with versions linked with other C
runtime
libraries, this is, they cannot be mixed

from MSDN docs:
"Having more than one copy of the run-time libraries in a process can cause
problems, because static data in one copy is not shared with the other copy.
To ensure that your process contains only one copy, avoid mixing static and
dynamic versions of the run-time libraries. The linker will prevent you from
linking with both static and dynamic versions within one .EXE file, but you
can still end up with two (or more) copies of the run-time libraries. For
example, a dynamic-link library linked with the static (non-DLL) versions of
the run-time libraries can cause problems when used with an .EXE file that
was linked with the dynamic (DLL) version of the run-time libraries. (You
should also avoid mixing the debug and non-debug versions of the libraries
in one process.)"

so, right now, allegro for mingw32 (dll and static) are being compiled with
MSVCRT.DLL (the /MD) equivalent, since it is the only way it supports

but the odd thing is that the MSVC version is being compiled with the
/MT (multithreaded) option (both DLL and static) making it "virtually"
incompatible with mingw32 DLL version

so, to the point, i would like to either:
1) make allegro compile 3 dll and static versions (ML, MT and MD) so they
can be used by any MSVC program, no matter what C lib they select

i would like that one, but i bet a lot of you won't like so much versions =)
or at least:
2) change MSVC compiling to use /MD parameter (like mingw32) instead of
/MT one

the last change would only take 2 character changes in the makefile.vc (that
is attached)

comments?

Attachment: makefile.vc.dif
Description: video/dv



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