[Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

Simon Marlow marlowsd at gmail.com
Wed Jun 17 04:46:49 EDT 2009


On 17/06/2009 09:38, Bulat Ziganshin wrote:
> Hello Simon,
>
> Wednesday, June 17, 2009, 11:55:15 AM, you wrote:
>
>> Right, so getArgs is already fine.
>
> it's what i've found in Jun15 sources:
>
> #ifdef __GLASGOW_HASKELL__
> getArgs :: IO [String]
> getArgs =
>    alloca $ \ p_argc ->
>    alloca $ \ p_argv ->  do
>     getProgArgv p_argc p_argv
>     p<- fromIntegral `liftM` peek p_argc
>     argv<- peek p_argv
>     peekArray (p - 1) (advancePtr argv 1)>>= mapM peekCString
>
>
> foreign import ccall unsafe "getProgArgv"
>    getProgArgv :: Ptr CInt ->  Ptr (Ptr CString) ->  IO ()
>
>
> it uses peekCString so by any means it cannot produce unicode chars

I see, so you were previously quoting code from some other source. 
Where did the GetCommandLineW version come from?  Do you know of any 
issues that would prevent us using it in GHC?

Cheers,
	Simon



More information about the Haskell-Cafe mailing list