Add -DUNICODE to the wineg++ options. TCHAR is char without it.

2010/11/17 飞翔 <gengjia.ding@qq.com>
  
 
I try  as you said in my program as below:
#include <windows.h>
#include <stdio.h>
#include <wchar.h>

int  main()
{
    DWORD dwItems = 1;
    TCHAR ptszIPAddress[32] = TEXT("125.216.242.251");
    dwItems = (DWORD)wcslen((const wchar_t*)ptszIPAddress) + 1;
    printf("dwItems %d\n", dwItems);
    return 0;
}

but the result of the variable dwItems is 9, while in Windows environment is 16, why?
 
 
   

 
 
------------------ 原始邮件 ------------------
发件人: "Damjan Jovanovic"<damjan.jov@gmail.com>;
发送时间: 2010年11月16日(星期二) 凌晨2:14
收件人: "飞翔"<gengjia.ding@qq.com>;
抄送: "wine-devel"<wine-devel@winehq.org>;
主题: Re: how to use wcslen() in wine?
 
Try:
wineg++ -I /usr/include/wine/include/msvcrt file.cpp -o file -lmsvcrt

2010/11/15 飞翔 <gengjia.ding@qq.com>
>
>
>
> hello, I'm developing under Wine environment.
>  I'm using Unicode and I want to be able to use standard library call wcslen, but I don't know how to change my C library from the native glibc C library to the msvcrt C library.
>  As it is described in "Winelib_User's_Guide":"In these cases you should use msvcrt to provide your C runtime calls.
>  import msvcrt.dll
> to your applications .spec file."
> I'm using wineg++ to compile the .cpp & .h files, there is no .spec file, how can I import the DLL?
> May you please help me? Thanks very much!
>
>
> ------------------
> Where there is a will, there is a way!
> ------------------
> 丁耿佳
> Gavin-Ding
> Computer Science and Technology,South China University of Technology
> Email: gj.ding@mail.scut.edu.cn
> gengjia.ding@gmail.com
gengjia.ding@qq.com
> Mailing Address: 339, Building C12, SCUT, GuangzhouHigher Education Mega Center, Guangzhou, China
> Postcode:510006
>
>
>
>
>