on master help sign in
fix Win32 moveFileEx API variation

fix too many export symbols ld error on Windows- prevents usage of project-m36 as DLL on Windows resolves #219

commit4eef8665c419d8207004de05d9517dc661ab71ae authorAgentM <agentm@themactionfaction.com> dateMon 22 Oct 2018, 19:39 (8 years ago) parent9007522
2 files changed+13−8
project-m36.cabal+5−3 src/lib/ProjectM36/Persist.hs+8−5
project-m36.cabal+5−3
@@ -101,11 +101,13 @@ Library
101101 ProjectM36.FileLock,
102102 ProjectM36.FSType,
103103 ProjectM36.Arbitrary
104− GHC-Options: -Wall -rdynamic
104+ GHC-Options: -Wall
105105 if os(windows)
106106 Build-Depends: Win32 >= 2.5.4.1
107107 Other-Modules: ProjectM36.Win32Handle
108108 else
109+ --219- too many exported symbols under Windows and GHC 8.4
110+ GHC-Options: -rdynamic
109111 C-sources: cbits/DirectoryFsync.c, cbits/darwin_statfs.c
110112 Build-Depends: unix
111113 CC-Options: -fPIC
@@ -175,8 +177,8 @@ Executable tutd
175177 TutorialD.Interpreter.TransGraphRelationalOperator,
176178 TutorialD.Interpreter.SchemaOperator
177179 main-is: TutorialD/tutd.hs
178− CC-Options: -fPIC
179− GHC-Options: -Wall -rdynamic -threaded
180+ CC-Options: -fPIC -rdynamic
181+ GHC-Options: -Wall -threaded
180182 Hs-Source-Dirs: ./src/bin
181183 Default-Language: Haskell2010
182184 Default-Extensions: OverloadedStrings
src/lib/ProjectM36/Persist.hs+8−5
@@ -66,7 +66,13 @@ renameSync sync srcPath dstPath = do
6666atomicRename :: FilePath -> FilePath -> IO ()
6767atomicRename srcPath dstPath =
6868#if defined(mingw32_HOST_OS)
69− Win32.moveFileEx srcPath dstPath Win32.mOVEFILE_REPLACE_EXISTING
69+#if MIN_VERSION_Win32(2,6,0)
70+ let dst = Just dstPath
71+#else
72+ let dst = dstPath
73+#endif
74+ in
75+ Win32.moveFileEx srcPath dst Win32.mOVEFILE_REPLACE_EXISTING
7076#else
7177 Posix.rename srcPath dstPath
7278#endif
@@ -119,13 +125,10 @@ printFdCount =
119125 putStrLn "Fd count not supported on this OS."
120126#endif
121127
122−
123−fdCount :: IO Int
124128#if FDCOUNTSUPPORTED
129+fdCount :: IO Int
125130fdCount = do
126131 fds <- getDirectoryContents FDDIR
127132 pure ((length fds) - 2)
128−#else
129133--not supported on non-linux
130−fdCount = pure 0
131134#endif