On Sun, Apr 06, 2008 at 10:08:41PM +0100, Neil Mitchell wrote:
> >   We were mallocing a byte per tchar, but tchars are normally 2 bytes big...
> >   I think they are at most 4 bytes, so we now malloc 4 * #tchars. Not sure
> >   if there is a proper function I should be using for this?
> 
> TCHAR is #ifdef'd to be either CHAR on Win 9x/ME (1 byte), or WCHAR on
> Win 2k/XP/Vista (2 bytes). In C you'd just do sizeof(TCHAR), not sure
> if there is a way of doing this from Haskell.

Well there's sizeof (undefined :: TCHAR).  Where the pointer has type
LPTSTR = Ptr TCHAR, mallocArray will do it.  (Actually allocaArray seems
like a better choice in this context.)
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to