From: RB on
To compile my app for unicode, my notes tell me where to insert
_UNICODE and UNICODE so that much I understand, but I have
two questions at this point.

1. When I goto the settings I found that _MBCS was already defined.
I surmise I should delete this, but why was this defined as a default ?

(and for my VS 6.0 version)
2. Also in my notes I have to put wWinMainCRTStartup as the entry
point symbol. I am curious what is going down with this. Am I to
understand that the "w" is a wide format CRT lib ? And possibly
the OS loader will turn execution over the app at this point for
further initialization ?

It appears for VS 2005 question 2 is taken care of automatically after the
UNICODE setting is done, I surmise for my old VS 6.0 the concept of
unicode was not quite as automatic


From: David Ching on
"RB" <NoMail(a)NoSpam> wrote in message
news:uId9YoN5KHA.1932(a)TK2MSFTNGP05.phx.gbl...
> To compile my app for unicode, my notes tell me where to insert
> _UNICODE and UNICODE so that much I understand, but I have
> two questions at this point.
>
> 1. When I goto the settings I found that _MBCS was already defined.
> I surmise I should delete this, but why was this defined as a default ?
>

For VS 2005/2008/2010: You should not manually define the preprocessor
symbols _UNICODE and UNICODE. Instead, change the project's General
Properties. Look for "Character Set".

For VS6, _MBCS is defined with the rest of the preprocessor symbols in the
Project Settings, C/C++ tab, Category: General, "Preprocessor definitions".



> (and for my VS 6.0 version)
> 2. Also in my notes I have to put wWinMainCRTStartup as the entry
> point symbol. I am curious what is going down with this. Am I to
> understand that the "w" is a wide format CRT lib ? And possibly
> the OS loader will turn execution over the app at this point for
> further initialization ?
>
> It appears for VS 2005 question 2 is taken care of automatically after the
> UNICODE setting is done, I surmise for my old VS 6.0 the concept of
> unicode was not quite as automatic

Apparently in VS 2005/2008, with the General Properties "Character set"
setting took care of setting the different entry point. Since there is no
such setting in VS 6, you have to set it yourself.

-- David


From: Joseph M. Newcomer on
For purposes of testing, you really should create a new configuration, so you have Debug,
Release, Unicode Debug and Unicode Release as options. This will let you test out your
code easily under a number of scenarios. "Batch build" will let you build all
configurations at once, if you want.

_MBCS is defined in VS6 and < VS2005 by default because that is what they are defined to
do. No deeper reason.

Note that the need to specify wWinMainCRTStartup is sort of an ugly hack; in a real
system, this would have been properly handled without it being "in your face" as it is in
VS. There is *always* such a startup routine; it is just that by default you never see it
in a normal build. There is always "further initialization" in any application; for
example, parsing of the command line string into argc and argv[], stack creation, for C++,
invoking the static initializers, and on and on. Tons of stuff happen long before 'main'
or 'WinMain' are ever called!

THe idea that 'main' is where execution begins is completely and utterly an illiusion; not
in the entire history of the C language did execution of an application start at 'main'.
There have been hundreds to thousands to possibly tens of thousdands of instructions
executed before main is called, and this has always been true, even on the 1975 PDP-11
implementation of C.
joe

On Sun, 25 Apr 2010 20:47:38 -0400, "RB" <NoMail(a)NoSpam> wrote:

>To compile my app for unicode, my notes tell me where to insert
>_UNICODE and UNICODE so that much I understand, but I have
>two questions at this point.
>
>1. When I goto the settings I found that _MBCS was already defined.
> I surmise I should delete this, but why was this defined as a default ?
>
> (and for my VS 6.0 version)
>2. Also in my notes I have to put wWinMainCRTStartup as the entry
> point symbol. I am curious what is going down with this. Am I to
> understand that the "w" is a wide format CRT lib ? And possibly
> the OS loader will turn execution over the app at this point for
> further initialization ?
>
>It appears for VS 2005 question 2 is taken care of automatically after the
>UNICODE setting is done, I surmise for my old VS 6.0 the concept of
>unicode was not quite as automatic
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Giovanni Dicanio on
"RB" <NoMail(a)NoSpam> ha scritto nel messaggio
news:uId9YoN5KHA.1932(a)TK2MSFTNGP05.phx.gbl...
> To compile my app for unicode, my notes tell me where to insert
> _UNICODE and UNICODE so that much I understand, but I have
> two questions at this point.

To add to what David and Joe wrote, I'd like to suggest you the following
Mihai's blog post:

"Visual Studio Unicode projects"
http://mihai-nita.net/2006/07/23/visual-studio-unicode-projects/

Giovanni


From: RB on
>For purposes of testing, you really should create a new configuration, so you
>have Debug, Release, Unicode Debug and Unicode Release as options.
>This will let you test out your code easily under a number of scenarios.

Thanks, that is a good idea.

> _MBCS is defined in VS6 and < VS2005 by default because that is what they are
> defined to do. No deeper reason.

Ok so I don't have to delete them ? I thought they had something to do with oriental
characters and was confused as to why they were set at default. But I probably missed
something on that browsing read.

> Note that the need to specify wWinMainCRTStartup is sort of an ugly hack; in a real
> system, this would have been properly handled without it being "in your face" as it is in
> VS. There is *always* such a startup routine; it is just that by default you never see it
> in a normal build. There is always "further initialization" in any application;

Thanks again


 |  Next  |  Last
Pages: 1 2
Prev: StringCchCopy question
Next: Finding Memory Leaks