Skip to content

Commit

Permalink
FIx WinIO CPP guard
Browse files Browse the repository at this point in the history
Escapes the CPP guard so GHC sees it instead of hsc2hs

(cherry picked from commit 530c5ec)
  • Loading branch information
Mistuke committed Jun 28, 2021
1 parent 6775f8c commit 1604318
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions System/Win32/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ foreign import ccall unsafe "_get_osfhandle"

-- Originally authored by Max Bolingbroke in the ansi-terminal library
withHandleToHANDLE :: Handle -> (HANDLE -> IO a) -> IO a
#if defined(__IO_MANAGER_WINIO__)
##if defined(__IO_MANAGER_WINIO__)
withHandleToHANDLE = withHandleToHANDLEPosix <!> withHandleToHANDLENative
#else
##else
withHandleToHANDLE = withHandleToHANDLEPosix
#endif
##endif

#if defined(__IO_MANAGER_WINIO__)
##if defined(__IO_MANAGER_WINIO__)
withHandleToHANDLENative :: Handle -> (HANDLE -> IO a) -> IO a
withHandleToHANDLENative haskell_handle action =
-- Create a stable pointer to the Handle. This prevents the garbage collector
Expand All @@ -293,7 +293,7 @@ withHandleToHANDLENative haskell_handle action =
windows_handle <- handleToHANDLE haskell_handle
-- Do what the user originally wanted
action windows_handle
#endif
##endif

withHandleToHANDLEPosix :: Handle -> (HANDLE -> IO a) -> IO a
withHandleToHANDLEPosix haskell_handle action =
Expand Down
2 changes: 1 addition & 1 deletion Win32.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Win32
version: 2.10.1.0
version: 2.10.1.1
license: BSD3
license-file: LICENSE
author: Alastair Reid, shelarcy, Tamar Christina
Expand Down

0 comments on commit 1604318

Please sign in to comment.