diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
-PROJECT(fltkc)
-
-# CMake doesn't like backslashes in path
-STRING("REGEX" "REPLACE" "\\\\" "/" "FLTK_HOME" "${FLTK_HOME}")
-
-if(EXISTS "${FLTK_HOME}/build/lib/libfltk_z.a")
-  SET(FLTK_Z "${FLTK_HOME}/build/lib/libfltk_z.a")
-else()
-  find_library(HAVE_Z z)
-  SET(FLTK_Z "${HAVE_Z}")
-endif()
-
-if(EXISTS "${FLTK_HOME}/build/lib/libfltk_jpeg.a")
-  SET(FLTK_JPEG "${FLTK_HOME}/build/lib/libfltk_jpeg.a")
-else()
-  find_library(HAVE_JPEG jpeg)
-  SET(FLTK_JPEG "${HAVE_JPEG}")
-endif()
-
-if(EXISTS "${FLTK_HOME}/build/lib/libfltk_png.a")
-  SET(FLTK_PNG "${FLTK_HOME}/build/lib/libfltk_png.a")
-else()
-  find_library(HAVE_PNG png)
-  SET(FLTK_PNG "${HAVE_PNG}")
-endif()
-
-INCLUDE_DIRECTORIES(${FLTK_HOME})
-LINK_DIRECTORIES("${FLTK_HOME}/build/lib")
-SET(FLTKLINKFLAGS "-Wl,-Bstatic")
-SET(FLTKLINKFLAGS "${FLTKLINKFLAGS} -lfltk.a -lfltk_gl -lfltk_images.a ${FLTK_PNG} ${FLTK_JPEG} ${FLTK_Z} -lfltk_forms")
-SET(FLTKLINKFLAGS "${FLTKLINKFLAGS} -Wl,-Bdynamic")
-
-# target_link_libraries doesn't accept libraries as absolute path and
-# find_library usually returns path to import library instead static one
-# so replace any string in form of 'c:/dev/lib/libfoo.dll.a' with '-lfoo'
-STRING(REGEX REPLACE "[^ ]*/lib" "-l" FLTKLINKFLAGS ${FLTKLINKFLAGS})
-STRING(REGEX REPLACE "\\.dll\\.a|\\.a" "" FLTKLINKFLAGS ${FLTKLINKFLAGS})
-
-SET(FLTKLINKFLAGS "${FLTKLINKFLAGS} -lglu32 -lopengl32 -lole32 -luuid -lcomctl32 -lComdlg32 -static-libstdc++ -static-libgcc")
-
-# Newer versions of MinGW come with libwinpthread which gets linked dynamicaly by default
-find_library (HAVE_PTHREAD pthread)
-IF(HAVE_PTHREAD)
-	SET(FLTKLINKFLAGS "${FLTKLINKFLAGS} -Wl,-Bstatic,-lstdc++,-lpthread,-Bdynamic")
-else()
-	SET(FLTKLINKFLAGS "${FLTKLINKFLAGS} -Wl,-Bstatic,-lstdc++,-Bdynamic")
-endif()
-
-
-SET(FLTKCONFIGCOMMAND "-Wl,-Bstatic,-whole-archive,-lfltkc,-no-whole-archive,-Bdynamic -L${FLTK_HOME}/build/lib -L${CMAKE_CURRENT_SOURCE_DIR}/c-lib ${FLTKLINKFLAGS}")
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/fltkhs.buildinfo.in
-               ${CMAKE_CURRENT_SOURCE_DIR}/fltkhs.buildinfo)
-FIND_PACKAGE(OpenGL REQUIRED)
-set_directory_properties(PROPERTIES
-                         ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake_install.cmake;
-                                                      ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt;
-                                                      ${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles")
-ADD_SUBDIRECTORY(c-src)
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -26,7 +26,7 @@
 import qualified Distribution.ModuleName as ModuleName
 import Distribution.Simple.BuildPaths
 import System.Directory(getCurrentDirectory, getDirectoryContents, doesDirectoryExist)
-import System.FilePath ( (</>), (<.>), takeExtension, combine, takeBaseName)
+import System.FilePath ( (</>), (<.>), takeExtension, combine, takeBaseName, takeDirectory)
 import qualified Distribution.Simple.GHC  as GHC
 import qualified Distribution.Simple.JHC  as JHC
 import qualified Distribution.Simple.LHC  as LHC
@@ -37,10 +37,8 @@
 import System.Environment (getEnv, setEnv)
 
 main :: IO ()
-main = defaultMainWithHooks defaultUserHooks {
-  preConf = case buildOS of
-              Windows -> myCMakePreConf
-              _ -> myPreConf,
+main = defaultMainWithHooks autoconfUserHooks {
+  preConf = myPreConf,
   buildHook = myBuildHook,
   cleanHook = myCleanHook,
   copyHook = copyCBindings,
@@ -50,34 +48,40 @@
 myPreConf :: Args -> ConfigFlags -> IO HookedBuildInfo
 myPreConf args flags = do
    putStrLn "Running autoconf ..."
-   rawSystemExit normal "autoconf" []
-   preConf defaultUserHooks args flags
-
-myCMakePreConf :: Args -> ConfigFlags -> IO HookedBuildInfo
-myCMakePreConf args flags =
-  do
-    let runCMake = do
-        fltkHome <- getEnv "FLTK_HOME"
-        putStrLn "Running cmake ..."
-        rawSystemExit verbose "cmake" [".", "-G", "MSYS Makefiles", "-DFLTK_HOME=" ++ fltkHome]
-    clibExists <- doesDirectoryExist fltkcdir
-    if (not clibExists)
-     then runCMake
-     else do
-       libs <- getDirectoryContents fltkcdir
-       if (null $ filter ((==) "libfltkc.dll") libs)
-        then runCMake
-        else return ()
-       return ()
-    preConf defaultUserHooks args flags
+   case buildOS of
+     Windows -> rawSystemExit normal "sh" ["autoconf"]
+     _ -> rawSystemExit normal "autoconf" []
+   preConf autoconfUserHooks args flags
 
-fltkcdir = unsafePerformIO getCurrentDirectory ++ "/c-lib"
+fltkcdir :: FilePath
+fltkcdir = unsafePerformIO $ do
+  d <- getCurrentDirectory
+  return (d </> "c-lib")
 fltkclib = "fltkc"
 
+
+addFltkcDir :: PackageDescription -> PackageDescription
+addFltkcDir pkg_descr =
+  pkg_descr {
+     library = fmap (\l' -> l' {
+                              libBuildInfo =
+                                 (libBuildInfo l') {
+                                    extraLibDirs = (extraLibDirs (libBuildInfo l')) ++ [fltkcdir]
+                                 }
+                            }
+                    )
+                    (library pkg_descr)
+  }
+
 addToEnvironmentVariable :: String -> String -> IO ()
 addToEnvironmentVariable env value = do
   currentLdLibraryPath <- tryIOError (getEnv env)
-  setEnv env ((either (const "") (\curr -> curr ++ ":") currentLdLibraryPath) ++ value)
+  setEnv env ((either (const "")
+                      (\curr -> curr ++
+                               (case buildOS of
+                                  Windows -> ";"
+                                  _ -> ":"))
+                      currentLdLibraryPath) ++ value)
 
 myBuildHook pkg_descr local_bld_info user_hooks bld_flags =
   do let compileC = do
@@ -95,39 +99,82 @@
         when (null $ filter (Data.List.isInfixOf "fltkc") clibraries) compileC
        else compileC
      case buildOS of
-       Windows -> addToEnvironmentVariable "PATH" fltkcdir
+       Windows ->
+         let rewritePaths :: PackageDescription -> IO PackageDescription
+             rewritePaths pkg_descr =
+               let lib = library pkg_descr
+                   ld_incdirs :: Maybe ([String], [String])
+                   ld_incdirs = fmap (\lib' -> (ldOptions (libBuildInfo lib'), includeDirs (libBuildInfo lib')))  lib
+                   removeTrailingNewline = head . lines
+                   replaceAllInfixes :: String -> String -> String -> String
+                   replaceAllInfixes needle subString haystack =
+                     concat
+                       (unfoldr (\str -> if (null str)
+                                         then Nothing
+                                         else if (needle `isPrefixOf` str)
+                                              then Just (subString, drop (length needle) str)
+                                              else Just ([head str], tail str))
+                                haystack)
+                   stdCppGccPthreadPaths ghcPath =
+                      [
+                        ((takeDirectory . takeDirectory) ghcPath) </> "mingw" </> "lib" </> "gcc" </> "x86_64-w64-mingw32" </> "5.2.0"
+                      , ((takeDirectory . takeDirectory) ghcPath) </> "mingw" </> "x86_64-w64-mingw32" </> "lib"
+                      ]
+                   cygpath o p = removeTrailingNewline<$>(rawSystemStdout normal "cygpath" [o,  p])
+               in
+               do
+                 fullMingwPath <- cygpath "-m" "/mingw64"
+                 ghcPath <- rawSystemStdout normal "sh" ["-c", "which ghc"]
+                 cppGccPthreadPaths <- mapM (cygpath "-w") (stdCppGccPthreadPaths ghcPath)
+                 let replaceMingw = replaceAllInfixes "/mingw64" fullMingwPath
+                 let fixedLib = maybe Nothing
+                                     (\(ld, incDirs) ->
+                                          fmap (\l' -> l' {
+                                                   libBuildInfo =
+                                                     (libBuildInfo l') {
+                                                        ldOptions = fmap replaceMingw ld,
+                                                        includeDirs = fmap replaceMingw incDirs,
+                                                        extraLibDirs = cppGccPthreadPaths ++ (extraLibDirs (libBuildInfo l')),
+                                                        extraLibs = ["stdc++", "gcc", "pthread"]
+                                                     }
+                                                })
+                                                lib
+                                     )
+                                     ld_incdirs
+                 return (pkg_descr {library = fixedLib})
+         in do
+           fixedPkgDescr <- rewritePaths pkg_descr >>= return . addFltkcDir
+           buildHook autoconfUserHooks fixedPkgDescr local_bld_info user_hooks bld_flags
        Linux -> do
          addToEnvironmentVariable "LD_LIBRARY_PATH" fltkcdir
          addToEnvironmentVariable "LIBRARY_PATH" fltkcdir
+         buildHook autoconfUserHooks pkg_descr local_bld_info user_hooks bld_flags
        _ -> do
          addToEnvironmentVariable "DYLD_LIBRARY_PATH" fltkcdir
          addToEnvironmentVariable "LIBRARY_PATH" fltkcdir
-     buildHook defaultUserHooks pkg_descr local_bld_info user_hooks bld_flags
+         buildHook autoconfUserHooks pkg_descr local_bld_info user_hooks bld_flags
 
+
 copyCBindings :: PackageDescription -> LocalBuildInfo -> UserHooks -> CopyFlags -> IO ()
 copyCBindings pkg_descr lbi uhs flags = do
-    (copyHook defaultUserHooks) pkg_descr lbi uhs flags
+    (copyHook autoconfUserHooks) pkg_descr lbi uhs flags
     let libPref = libdir . absoluteInstallDirs pkg_descr lbi
                 . fromFlag . copyDest
                 $ flags
     rawSystemExit (fromFlag $ copyVerbosity flags) "cp"
-        ["c-lib" </> "libfltkc.a", libPref]
+        [fltkcdir </> "libfltkc.a" , libPref]
     case buildOS of
-     os | os `elem` [Linux, FreeBSD, OpenBSD, NetBSD, DragonFly]
-       -> rawSystemExit (fromFlag $ copyVerbosity flags) "cp"
-            ["c-lib" </> "libfltkc-dyn.so", libPref]
      OSX -> rawSystemExit (fromFlag $ copyVerbosity flags) "cp"
               ["c-lib" </> "libfltkc-dyn.dylib", libPref]
-     Windows ->
-            rawSystemExit (fromFlag $ copyVerbosity flags) "cp"
-              ["c-lib" </> "libfltkc-dyn.dll", libPref]
+     _ -> rawSystemExit (fromFlag $ copyVerbosity flags) "cp"
+            ["c-lib" </> "libfltkc-dyn.so", libPref]
 
 myCleanHook pd x uh cf = do
   case buildOS of
    os | os `elem` [FreeBSD, OpenBSD, NetBSD, DragonFly]
      -> rawSystemExit normal "gmake" ["clean"]
    _ -> rawSystemExit normal "make" ["clean"]
-  cleanHook defaultUserHooks pd x uh cf
+  cleanHook autoconfUserHooks pd x uh cf
 
 -- Based on code in "Gtk2HsSetup.hs" from "gtk" package
 registerHook pkg_descr localbuildinfo _ flags =
@@ -159,11 +206,7 @@
      _ | modeGenerateRegFile   -> writeRegistrationFile installedPkgInfo
        | modeGenerateRegScript -> die "Generate Reg Script not supported"
        | otherwise             ->
-#if __GLASGOW_HASKELL__ >= 800
           registerPackage verbosity (compiler lbi) (withPrograms lbi) False {- multiinstance -} packageDbs installedPkgInfo
-#else
-          registerPackage verbosity installedPkgInfo pkg lbi inplace packageDbs
-#endif
   where
     modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))
     regFile             = fromMaybe (display (packageId pkg) <.> "conf")
diff --git a/c-src/CMakeCopyObjectFiles.txt b/c-src/CMakeCopyObjectFiles.txt
deleted file mode 100644
--- a/c-src/CMakeCopyObjectFiles.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-function(copyObjectFiles)
-  file(GLOB_RECURSE ObjectFiles ${CMAKE_CURRENT_SOURCE_DIR} *.obj)
-  file(COPY ${ObjectFiles} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../static_object_files)
-endfunction(copyObjectFiles)
-copyObjectFiles()
diff --git a/c-src/CMakeLists.txt b/c-src/CMakeLists.txt
deleted file mode 100644
--- a/c-src/CMakeLists.txt
+++ /dev/null
@@ -1,126 +0,0 @@
-SET(SourceFiles
-  Fl_Menu_ButtonC.cpp
-  Fl_PositionerC.cpp
-	Fl_TimerC.cpp
-	Fl_Value_OutputC.cpp
-	Fl_Value_SliderC.cpp
-	Fl_ScrollbarC.cpp
-	Fl_ScrollC.cpp
-	Fl_RollerC.cpp
-	Fl_DialC.cpp
-	Fl_CounterC.cpp
-	UtilsC.cpp
-	xC.cpp
-	fl_utf8C.cpp
-	glC.cpp
-	glutC.cpp
-	DerivedText_Editor.cpp
-	DerivedShared_Image.cpp
-	filenameC.cpp
-	Fl_AskC.cpp
-	Fl_BitmapC.cpp
-	Fl_BoxC.cpp
-	Fl_BrowserC.cpp
-	Fl_ButtonC.cpp
-	Fl_CallbackC.cpp
-	Fl_C.cpp
-	Fl_Check_ButtonC.cpp
-	Fl_ChoiceC.cpp
-	Fl_ClockC.cpp
-	Fl_Color_ChooserC.cpp
-	Fl_Copy_SurfaceC.cpp
-	Fl_Double_WindowC.cpp
-	Fl_DrawC.cpp
-	Fl_DeviceC.cpp
-	Fl_EnumerationsC.cpp
-	Fl_File_BrowserC.cpp
-	Fl_File_IconC.cpp
-	Fl_File_InputC.cpp
-	Fl_File_ChooserC.cpp
-	Fl_Float_InputC.cpp
-	Fl_Gl_WindowC.cpp
-	Fl_GroupC.cpp
-	Fl_Hold_BrowserC.cpp
-	Fl_Image_SurfaceC.cpp
-	Fl_ImageC.cpp
-	Fl_Input_C.cpp
-	Fl_InputC.cpp
-	Fl_Int_InputC.cpp
-	Fl_Light_ButtonC.cpp
-	Fl_Menu_C.cpp
-	Fl_Menu_ItemC.cpp
-	Fl_Multi_BrowserC.cpp
-	Fl_Multiline_InputC.cpp
-	Fl_Multiline_OutputC.cpp
-	Fl_Native_File_ChooserC.cpp
-	Fl_OutputC.cpp
-	Fl_Overlay_WindowC.cpp
-	Fl_Paged_DeviceC.cpp
-	Fl_PixmapC.cpp
-	Fl_PNM_ImageC.cpp
-	Fl_PreferencesC.cpp
-	Fl_PrinterC.cpp
-	Fl_ProgressC.cpp
-	Fl_Radio_ButtonC.cpp
-	Fl_Radio_Light_ButtonC.cpp
-	Fl_Repeat_ButtonC.cpp
-	Fl_Return_ButtonC.cpp
-	Fl_RGB_ImageC.cpp
-	Fl_Round_ButtonC.cpp
-	Fl_Round_ClockC.cpp
-	Fl_Secret_InputC.cpp
-	Fl_Select_BrowserC.cpp
-  Fl_Shared_ImageC.cpp
-	fl_show_colormapC.cpp
-	Fl_Single_WindowC.cpp
-	Fl_SliderC.cpp
-	Fl_SpinnerC.cpp
-	Fl_Sys_Menu_BarC.cpp
-	Fl_TableC.cpp
-	Fl_Table_RowC.cpp
-	Fl_TabsC.cpp
-	Fl_Text_BufferC.cpp
-	Fl_Text_DisplayC.cpp
-	Fl_Text_EditorC.cpp
-	Fl_Text_SelectionC.cpp
-	Fl_TileC.cpp
-	Fl_PackC.cpp
-	Fl_Toggle_ButtonC.cpp
-	Fl_TooltipC.cpp
-	Fl_TreeC.cpp
-	Fl_Tree_ItemC.cpp
-	Fl_Tree_PrefsC.cpp
-	Fl_ValuatorC.cpp
-	Fl_AdjusterC.cpp
-	Fl_Value_InputC.cpp
-	Fl_Value_SliderC.cpp
-	Fl_WidgetC.cpp
-	Fl_WindowC.cpp
-	Fl_WizardC.cpp
-  )
-
-ADD_DEFINITIONS("${CXX_FLAGS} -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -Wall -DINTERNAL_LINKAGE -g -Icpp -I\"${FLTK_HOME}/\"")
-# ADD_DEFINITIONS("${CXX_FLAGS} -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -Wall -DINTERNAL_LINKAGE -g -Icpp -I\"${FLTK_HOME}/include\"")
-
-# first build object library so that we can reuse same objects for both static and shared library
-ADD_LIBRARY(fltkc_obj OBJECT ${SourceFiles})
-
-ADD_LIBRARY(fltkc-dyn SHARED $<TARGET_OBJECTS:fltkc_obj>)
-
-target_link_libraries(fltkc-dyn ${FLTKLINKFLAGS} -L${FLTK_HOME}/lib)
-
-set_target_properties(fltkc-dyn PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../c-lib
-                                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../c-lib)
-
-
-ADD_LIBRARY(fltkc_static STATIC $<TARGET_OBJECTS:fltkc_obj>)
-set_target_properties(fltkc_static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../c-lib
-                                              OUTPUT_NAME fltkc)
-
-
-set_directory_properties(PROPERTIES
-                         ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../c-lib;
-                                                      ${CMAKE_CURRENT_SOURCE_DIR}/../static_object_files;
-                                                      ${CMAKE_CURRENT_SOURCE_DIR}/cmake_install.cmake;
-                                                      ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt;
-                                                      ${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles;")
diff --git a/c-src/Makefile.in b/c-src/Makefile.in
--- a/c-src/Makefile.in
+++ b/c-src/Makefile.in
@@ -121,6 +121,12 @@
 	SHARED_EXT=so
 	SONAME_FLAGS= -shared -Wl,-soname
 endif
+
+ifdef MSYSTEM
+else
+	FPIC= -fPIC
+endif
+
 .SILENT:
 all: libfltkc.a libfltkc-dyn.$(SHARED_EXT)
 .SUFFIXES: .cpp .o
@@ -128,8 +134,8 @@
 	test -d $(STATIC_OBJECT_FILES) || mkdir $(STATIC_OBJECT_FILES)
 	test -d $(SHARED_OBJECT_FILES) || mkdir $(SHARED_OBJECT_FILES)
 	@echo "*** Compiling $<..."
-	$(CXXSTATIC) -c -fPIC $^ -o $(STATIC_OBJECT_FILES)/$@
-	$(CXXSHARED) -c -fPIC $^ -o $(SHARED_OBJECT_FILES)/$@
+	$(CXXSTATIC) -c $(FPIC) $^ -o $(STATIC_OBJECT_FILES)/$@
+	$(CXXSHARED) -c $(FPIC) $^ -o $(SHARED_OBJECT_FILES)/$@
 libfltkc.a : $(OBJECTS)
 	test -d $(LIBDIR) || mkdir $(LIBDIR)
 	@echo "*** Linking $@..."
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -13,21 +13,8 @@
 # Checks for header files.
 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
 AC_CHECK_LIB([dl], [main])
-AC_CHECK_LIB([fltk], [fl_alphasort])
-AC_CHECK_LIB([fltk_images],
-             [main],
-             ImagesFlag='--use-images',
-             ImagesFlag='')
-AC_CHECK_LIB([fltk_cairo],
-             [main],
-             CairoFlag='--use-cairo',
-             CairoFlag='')
-AC_CHECK_LIB([fltk_forms],
-             [main],
-             FormsFlag='--use-forms',
-             FormsFlag='')
 
-AC_SUBST(FLTKCONFIGCOMMAND,"$(fltk-config --ldstaticflags --use-gl --use-glut $ImagesFlag $CairoFlag $FormsFlag) -lstdc++")
+AC_SUBST(FLTKCONFIGCOMMAND,"$(fltk-config --ldflags --use-gl --use-glut --use-images --use-forms) -lstdc++")
 AC_SUBST(FLTK_HOME,`fltk-config --includedir`)
 # Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_SIZE_T
diff --git a/fltkhs.cabal b/fltkhs.cabal
--- a/fltkhs.cabal
+++ b/fltkhs.cabal
@@ -1,5 +1,5 @@
 name : fltkhs
-version : 0.5.0.1
+version : 0.5.0.2
 synopsis : FLTK bindings
 description:
     Low level bindings for the FLTK GUI toolkit. For installation and quick start instruction please scroll all the way down to the README.
@@ -13,7 +13,7 @@
 -- copyright:
 category: UI,Graphics
 build-type: Custom
-cabal-version: >=1.20
+cabal-version: >=1.24
 source-repository head
   type: git
   location: http://github.com/deech/fltkhs
@@ -130,6 +130,11 @@
   if impl(ghc >= 7.10)
      cpp-options: -DOVERLAPPING_INSTANCES_DEPRECATED
 
+custom-setup
+  setup-depends:
+    base >= 4.5 && < 4.11,
+    Cabal < 1.25
+
 Executable fltkhs-fluidtohs
   Main-Is: Main.hs
   Hs-Source-Dirs: src/Fluid
@@ -148,8 +153,11 @@
     mtl
   default-language: Haskell2010
   ghc-Options: -Wall -threaded
+  if os(windows) && arch(x86_64)
+     cpp-options: -DWIN64
   if os(windows)
    ghc-Options: -optl-mwindows
+   ghc-Options: -pgml g++ "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"
   if os(darwin)
    ghc-Options: -pgml g++ "-optl-Wl,-lfltkc"
   if !os(darwin) && !os(windows)
@@ -164,8 +172,9 @@
   default-language: Haskell2010
   ghc-Options: -Wall -threaded
   if os(windows)
-   ghc-Options: -optl-mwindows
+    ghc-Options: -optl-mwindows
+    ghc-Options: -pgml g++ "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"
   if os(darwin)
-   ghc-Options: -pgml g++ "-optl-Wl,-lfltkc"
+    ghc-Options: "-optl-Wl,-lfltkc"
   if !os(darwin) && !os(windows)
     ghc-Options: -pgml g++ "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lfltkc" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"
diff --git a/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs b/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs
--- a/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs
+++ b/src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs
@@ -24,8 +24,15 @@
 
          -- ** Installation (Windows 64-bit)
          --
-         -- $InstallationWindows
+         -- *** Windows 10
+         --
+         -- $InstallationWindows10
+         --
 
+         -- *** Windows 7
+         --
+         -- $InstallationWindows7
+
          -- * Demos
          --
          -- $Demos
@@ -630,9 +637,145 @@
 -- @
 --
 
--- $InstallationWindows
+-- $InstallationWindows10
 --
--- Note: Currently this package only works on 64-bit Windows.
+-- This install guide has been tested on a Windows 10, Thinkpad T450 w/ 16GB RAM.
+--
+-- == Install Stack
+-- Downloading and following the default instructions for the standard <https://www.stackage.org/stack/windows-x86_64-installer Windows installer> should be enough.
+-- If the install succeeded 'stack' should on the PATH. To test run 'cmd.exe' and do:
+--
+-- @
+-- > stack --version
+-- @
+--
+-- Now downloading and setup the latest GHC via 'stack':
+--
+-- @
+-- > stack setup
+-- @
+--
+-- From this point on we can live in the MSYS2 shell that comes with Stack. It is a far superior environment to the command prompt. To open the MSYS2 shell do:
+--
+-- @
+-- > stack exec mintty
+-- @
+--
+-- == Install Necessary Utilities via Pacman
+-- In the MSYS2 shell prompt do
+--
+-- @
+-- > pacman -Syy # updates the repos to pull the latest snapshot
+-- @
+--
+-- Now we need packages for download and extracting packages:
+--
+-- @
+-- > pacman -S wget
+-- > pacman -S tar
+-- > pacman -S unzip
+-- > pacman -S zip
+-- @
+--
+-- ... and building C/C++ programs:
+--
+-- @
+-- > pacman -S autoconf
+-- > pacman -S make
+-- > pacman -S automake
+-- @
+--
+-- == Download and Install FLTK
+--
+-- Download the latest stable build of FLTK:
+--
+-- @
+-- > wget --no-check-certificate http://www.fltk.org/software.php?VERSION=1.3.4-1&FILE=fltk/1.3.4-1/fltk-1.3.4-1-source.tar.gz
+-- @
+--
+-- Untar the FLTK archive and enter the directory:
+--
+-- @
+-- > tar -zxf fltk-1.3.4-1
+-- > cd fltk-1.3.4-1
+-- @
+--
+-- Configure, make and install:
+--
+-- @
+-- > ./configure --enable-gl --enable-shared --enable-localjpeg --enable-localzlib --enable-localpng
+-- > make
+-- > make install
+-- @
+--
+-- You can test your installation by running:
+--
+-- @
+-- > fltk-config
+-- 1.3.4-1
+-- @
+--
+-- == Download And Install The FLTKHS Hello World Skeleton
+-- The <https://github.com/deech/fltkhs-hello-world fltkhs-hello-world> skeleton is a simple Hello World GUI which provides the base structure for your application. Please see the 'Demos' section of this document for examples of apps that show off more complex uses of the API.
+--
+-- @
+-- > wget --no-check-certificate https://github.com/deech/fltkhs-hello-world/archive/master.zip
+-- > unzip fltkhs-hello-world-master.zip
+-- > mv fltkhs-hello-world-master fltkhs-hello-world
+-- > cd fltkhs-hello-world
+-- @
+--
+-- And install with:
+--
+-- @
+-- > stack install
+-- @
+--
+-- To test your installation do:
+--
+-- @
+-- > stack exec fltkhs-hello-world
+-- @
+--
+-- And you're off and running!
+--
+-- == Packaging A Windows Executable
+--
+-- While the 'fltkhs-hello-world' application you built above is mostly stand-alone the MSYS2 environment bundled with 'stack' seems to require 3 runtime DLLs. The DLLs are bundled with 'stack' so it's easy to zip them up with the executable and deploy. The required DLLs are: 'libstdc++-6.dll', 'libgcc_s_seh-1.dll' and 'libwinpthread-1.dll'.
+--
+--
+--
+-- First create the directory that will contain the executable and DLLs:
+--
+-- @
+-- > mkdir \/tmp\/fltkhs-hello-world
+-- @
+--
+-- Copy the executable over to that directory:
+--
+-- @
+-- > cp `which fltkhs-hello-world` \/tmp\/fltkhs-hello-world
+-- @
+--
+-- Copy over the DLLs. They are usually located in '../<ghc-version>/mingw/bin' but to make the process slightly less fragile we specify the directory relative to whatever 'ghc' is currently in 'stack' 's context:
+--
+-- @
+-- > cp `dirname $(which ghc)`..\/mingw\/bin\/libstdc++-6.dll \/tmp\/fltkhs-hello-world
+-- > cp `dirname $(which ghc)`..\/mingw\/bin\/libgcc_s_seh-1.dll \/tmp\/fltkhs-hello-world
+-- > cp `dirname $(which ghc)`..\/mingw\/bin\/libwinpthread-1.dll \/tmp\/fltkhs-hello-world
+-- @
+--
+-- Zip up archive:
+--
+-- @
+-- > cd /tmp
+-- > zip fltkhs-hello-world.zip fltkhs-hello-world/*
+-- @
+--
+-- And that's it! Any Windows 10 user should now be able to extract 'fltkhs-hello-world.zip' and run 'fltkhs-hello-world.exe'.
+--
+
+-- $InstallationWindows7
 --
 -- This install guide has been tested on Windows 7 64-bit with 8GB of RAM.
 --
diff --git a/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs b/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs
@@ -288,8 +288,13 @@
 type SharedImageHandler          = FunPtr (CString -> CUChar -> CInt -> Ptr ())
 type BoxDrawF                    = Rectangle -> Color -> IO ()
 type BoxDrawFPrim                = CInt -> CInt -> CInt -> CInt -> FlColor -> IO ()
+#ifdef WIN64
+type FDHandlerPrim               = CULLong -> Ptr () -> IO ()
+type FDHandler                   = CULLong -> IO ()
+#else
 type FDHandlerPrim               = CInt -> Ptr () -> IO ()
 type FDHandler                   = CInt -> IO ()
+#endif
 type TextModifyCb                = Int -> Int -> Int -> Int -> T.Text -> IO ()
 type TextModifyCbPrim            = CInt -> CInt -> CInt -> CInt -> Ptr CChar -> Ptr () -> IO ()
 type TextPredeleteCb             = BufferOffset -> Int -> IO ()
diff --git a/src/Graphics/UI/FLTK/LowLevel/Window.chs b/src/Graphics/UI/FLTK/LowLevel/Window.chs
--- a/src/Graphics/UI/FLTK/LowLevel/Window.chs
+++ b/src/Graphics/UI/FLTK/LowLevel/Window.chs
@@ -582,5 +582,4 @@
 -- sizeRangeWithArgs :: 'Ref' 'Window' -> 'Int' -> 'Int' -> 'OptionalSizeRangeArgs' -> 'IO' ()
 --
 -- waitForExpose :: 'Ref' 'Window' -> 'IO' ()
-
 -- @
diff --git a/stack.yaml b/stack.yaml
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,7 +1,7 @@
 # For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration.html
 
 # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
-resolver: lts-5.3
+resolver: lts-7.16
 
 # Local packages, usually specified by relative directory name
 packages:
