pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Wiki

PreparingMinGW

      
Search:  
 
 
sections
Removing msvcrt dependencies
Adding msys's /usr/local to mingw search path

Removing msvcrt dependencies

Even when msvcr71.dll is explicitly named on the command line as a place to link gcc still has an annoying tendency to link to msvcrt.dll for a few functions such as abort and fprintf. It may be that gcc falls back on the default configuration for functions called from compiler generated boilerplate code. Fortunately the defaults are read from an external text file.

Warning: the following change will make MingW link to msvcr71.dll by default. It is suggested that a backup of the configuration file be made before editing. In this way MingW can be easily switched back to msvcrt.dll linkage.

These instructions are for gcc-core-3.4.5 and mingw-runtime-3.11 . gcc 3.4.5 can build DLLs using shared library command line options. The 3.11 runtime includes a library for linkage against msvcr71.dll. It should be expected that newer versions of MingW, as they become available, will also provide good msvcr71 support.

Under the main MingW directory the configuration file has the pathname lib\gcc\mingw32\3.4.5\specs . To make msvcr71 the default C library only line 54 needs editing:

%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
Just replace -lmsvcrt with -lmsvcr71 and you are ready to go.

One other place with msvcrt dependencies is calls to non-ansi library functions, such as strdup. In newer versions of the Visual C library, such as msvcrt, the names of non-standard functions start with an underscore. But MingW provides backwards compatibility with earlier, non-underscored, names via library libmoldname.a. Unfortunately libmoldname.a links to msvcrt.dll. The solution is to build a new libmoldname that links to msvcr71.dll.

Download mingw-runtime-3.12-src.tar.gz (*) from here at SourceForge.NET and extract into its own directory. Copy lib\libmoldname.a from the MingW directory to the runtime directory. Open a MingW enabled prompt (**) and change to the runtime source directory. Now enter the following commands (taken from the MingW runtime make file):

ar x libmoldname.a isascii.o iscsym.o iscsymf.o toascii.o  strcasecmp.o strncasecmp.o wcscmpi.o
gcc -DRUNTIME=msvcrt -D__FILENAME__=moldname-msvcrt.def  -D__MSVCRT__ -C -E -P -xc-header moldname.def.in >moldname-msvcrt.def
dlltool --as as -k -U --dllname msvcr71.dll --def moldname-msvcrt.def  --output-lib libmoldname71.a
ar rc libmoldname71.a isascii.o iscsym.o iscsymf.o toascii.o  strcasecmp.o strncasecmp.o wcscmpi.o
ranlib libmoldname71.a

Copy libmoldname71.a to the lib subdirectory of MingW. Once again edit line 54 of lib\gcc\mingw32\3.4.5\specs, replacing -moldname with -lmoldname71. Now any references to non-standard library routines by their non-underscored names should link to msvcr71.dll instead of msvcrt.dll.

(*) A new version, 3.13, is available. For at least one person, it worked as described here.

(**) The MingW bin directory is in the program search path and environment variable MINGW_ROOT_DIRECTORY is set to the MingW directory path.

Adding msys's /usr/local to mingw search path

spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Jul 23, 2014

Jul 22, 2014

Jul 21, 2014

Jul 20, 2014

Jul 19, 2014

Jul 15, 2014

Jul 10, 2014

Jul 9, 2014

Jun 27, 2014



Jun 24, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)