wiki:WindowsMingGcc

Compiling DLLs on Windows with Windows Visual Studio

Compiling DLLs on Windows MinGW

NOTE: experimental, it does not work with python2.6 yet, in principle it could work like that:

  • Download from  http://sourceforge.net/projects/mingw/files/ latest version MinGW-5.1.6.exe. During installation select Full installation and install in the preset directory C:\MinGw. (It might be necessary to set the path set path=C:\MinGw\bin;%path%
  • Checkout ObsPy (use SVN client as described in installation instructions.
    svn co http://svn.geophysik.uni-muenchen.de/svn/obspy
  • "As of Python 2.5, the official distribution is built with MS-VC 2003. Python requires that all extensions be built with the same compiler. It is however possible to build such extensions using MinGW with the help of MSYS." ( MinGW FAQ,  MinGW old FAQ, FrequentlyAskedQuestions#MinGWIssues?). As extensively described in ( MinGW FAQ) do the following:
    pexports /c/WINDOWS/system32/python26.dll >python26.def
    dlltool -D python26.dll -d python26.def -l libpython26.a
    move libpython26.a C:/MinGW/lib
    
  • As an example the shared library of the GSE2 module is compiled.
    cd obspy.gse2\trunk\obspy\gse2\src\GSE_UTI
    gcc -c -DBUILD_DLL -I /path/to/python26/include buf.c
    gcc -c -DBUILD_DLL -I /path/to/python26/include gse_functions.c
    gcc -shared -o gse_functions.win32.dll -lm -lpython26 buf.o gse_functions.o
    
    The steps are similar to the ones described by the Makefile.