Index: src/options.cc
===================================================================
--- src/options.cc	(revision 185)
+++ src/options.cc	(working copy)
@@ -29,10 +29,15 @@
 #include <cstdlib>
 #include <set>
 
+#ifndef __MINGW32__
 extern "C" {
 #include <lua.h>
 #include <lauxlib.h>
 }
+#else
+#include <lua.h>
+#include <lauxlib.h>
+#endif 
 
 #ifdef __MINGW32__
 #       include <windows.h>
Index: src/lua.hh
===================================================================
--- src/lua.hh	(revision 185)
+++ src/lua.hh	(working copy)
@@ -23,10 +23,13 @@
 #include "ecl_geom.hh"
 #include "objects_decl.hh"
 
-extern "C" {
-    struct lua_State;
-}
+#ifdef __MINGW32__
+struct lua_State;
+#else 
+extern "C" struct lua_State;
+#endif
 
+
 namespace lua
 {
     using namespace enigma;
Index: src/editor.cc
===================================================================
--- src/editor.cc	(revision 185)
+++ src/editor.cc	(working copy)
@@ -35,10 +35,16 @@
 #include "display_internal.hh"
 #include "d_engine.hh"
 
+#ifndef __MINGW32__
 extern "C" {
 #include "lualib.h"
 #include "tolua++.h"
 }
+#else
+#include "lualib.h"
+#include "tolua++.h"
+#endif 
+
 #include "lua-editor.hh"
 
 using namespace std;
Index: src/d_models.cc
===================================================================
--- src/d_models.cc	(revision 185)
+++ src/d_models.cc	(working copy)
@@ -36,11 +36,17 @@
 using namespace std;
 using namespace ecl;
 
-
+#ifndef __MINGW32__
 extern "C" {
 #include "lualib.h"
 #include "tolua++.h"
 }
+#else
+#include "lualib.h"
+#include "tolua++.h"
+#endif 
+
+
 #include "lua-global.hh"
 #include "lua-display.hh"
 #include "lua-enigma.hh"
Index: src/lev/Proxy.cc
===================================================================
--- src/lev/Proxy.cc	(revision 185)
+++ src/lev/Proxy.cc	(working copy)
@@ -37,11 +37,16 @@
 #include <xercesc/util/XMLUniDefs.hpp>
 #include <xercesc/framework/MemBufInputSource.hpp>
 #include <xercesc/framework/Wrapper4InputSource.hpp>
- 
+
+#ifndef __MINGW32__
 extern "C" {
 #include "lua.h"
 #include "lauxlib.h"
 }
+#else
+#include "lua.h"
+#include "lauxlib.h"
+#endif 
 
 
 using namespace std;
Index: src/lua.cc
===================================================================
--- src/lua.cc	(revision 185)
+++ src/lua.cc	(working copy)
@@ -26,11 +26,17 @@
 #include "sound.hh"
 #include "options.hh"
 
+#ifndef __MINGW32__
 extern "C" {
 #include "lualib.h"
 #include "tolua++.h"
 }
+#else
+#include "lualib.h"
+#include "tolua++.h"
+#endif 
 
+
 #include "lua-display.hh"
 #include "lua-enigma.hh"
 #include "lua-ecl.hh"
Index: src/sound.cc
===================================================================
--- src/sound.cc	(revision 185)
+++ src/sound.cc	(working copy)
@@ -30,9 +30,13 @@
 #include <cassert>
 #include <memory>
 
+#ifndef __MINGW32__
 extern "C" {
 #include "lua.h"
 }
+#else
+#include "lua.h"
+#endif 
 
 
 using namespace std;
Index: lib-src/lua/tolua++.h
===================================================================
--- lib-src/lua/tolua++.h	(revision 185)
+++ lib-src/lua/tolua++.h	(working copy)
@@ -39,8 +39,14 @@
 
 typedef int lua_Object;
 
+#if defined(__cplusplus) && defined(__MINGW32__)
+  extern "C++" {
+#endif
 #include "lua.h"
 #include "lauxlib.h"
+#if defined(__cplusplus) && defined(__MINGW32__)
+  }
+#endif
 
 struct tolua_Error
 {
Index: lib-src/lua/Makefile.am
===================================================================
--- lib-src/lua/Makefile.am	(revision 185)
+++ lib-src/lua/Makefile.am	(working copy)
@@ -13,10 +13,20 @@
 
 else
 
-CFLAGSDEFAULT = @CFLAGS@
+if MINGW32 
 
+## Compile as c++
+CFLAGSDEFAULT = @CFLAGS@ -x c++ @CXXFLAGS@
+
+else
+
+CFLAGSDEFAULT= @CFLAGS@ 
+
 endif
+endif
 
+
+
 CFLAGS = $(CFLAGSDEFAULT)
 
 
Index: lib-src/lua/luaconf.h
===================================================================
--- lib-src/lua/luaconf.h	(revision 185)
+++ lib-src/lua/luaconf.h	(working copy)
@@ -731,6 +731,11 @@
 */
 
 
+#if defined(__cplusplus) && defined(__MINGW32__)
+#undef LUAI_TRY
+#define LUAI_TRY(L,c,a)	try { a } catch(lua_longjmp*) \
+	{ if ((c)->status == 0) (c)->status = -1; }
+#endif
 
 #endif
 
Index: tools/Makefile.am
===================================================================
--- tools/Makefile.am	(revision 185)
+++ tools/Makefile.am	(working copy)
@@ -7,8 +7,13 @@
 TTFTOOL = 
 endif
 
+if MINGW32
+noinst_PROGRAMS =  $(TTFTOOL)
+else
 noinst_PROGRAMS = tolua $(TTFTOOL)
+endif
 
+
 ttf2bmf_SOURCES = ttf2bmf.cc getopt.c getopt1.c getopt.h
 ttf2bmf_CXXFLAGS = @SDL_CFLAGS@
 ttf2bmf_LDADD = -lSDL_ttf
