[GHC] #3083: Win32 package should bind SHGetFolderPath

GHC trac at galois.com
Wed Mar 11 08:04:59 EDT 2009


#3083: Win32 package should bind SHGetFolderPath
----------------------------+-----------------------------------------------
Reporter:  duncan           |          Owner:                   
    Type:  feature request  |         Status:  new              
Priority:  normal           |      Component:  libraries (other)
 Version:  6.10.1           |       Severity:  normal           
Keywords:                   |       Testcase:                   
      Os:  Windows          |   Architecture:  x86              
----------------------------+-----------------------------------------------
 Currently Cabal binds this function so that we can find the "Program
 Files" directory on Windows:

 {{{
 foreign import stdcall unsafe "shlobj.h SHGetFolderPathA"
  c_SHGetFolderPath :: Ptr () -> CInt -> Ptr () -> CInt -> CString -> IO
 CInt
 }}}

 This is fine except that it does not work in ghci because we have no way
 to tell ghci that it would need to link to `shell32.dll`. As it happens we
 do not have to tell the static linker to use `shell32.dll` because it
 appears to link to it by default. This of course means that `runghc Setup`
 does not work on Windows for Cabal itself which trips up many users. The
 fact that the `README` tells people to use `ghc --make Setup` instead
 doesn't help a great deal. See
 [http://hackage.haskell.org/trac/hackage/ticket/325 Cabal ticket #325]

 What would be nice is if the Win32 package would bind
 [http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx
 SHGetFolderPath]. Then we just import it from the Win32 package and it'll
 work in ghci. Apparently, according to MSDN, this function is technically
 deprecated, however the replacement [http://msdn.microsoft.com/en-
 us/library/bb762188(VS.85).aspx SHGetKnownFolderPath] is only available in
 Vista and later so we probably need to bind it anyway. Note that
 `SHGetFolderPath` is in `shell32.dll` except on Windows 2000 which include
 it in `SHFolder.dll` which come with IE4 and later.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3083>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list