harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li" <xiaofeng...@gmail.com>
Subject Re: Strategy for Harmony to work with Visual Studio 2005?
Date Thu, 06 Jul 2006 09:19:26 GMT
Visual Studio 2005 (Whidbey VC8) C runtime library (CRT) has changed
some compilation rules and APIs for better security or ISO/ANSI
conformance. Many changes are "breaking", i.e., incompatible. For
example, it adds safer counterparts for many functions like `strcpy_s'
for `strcpy', `sprintf_s' for `sprintf', etc. In this example, the
safer version has an additional parameter asking for the buffer size
of the destination string to prevent buffer overflow [1] .

I personally like the changes, since they make code safer. But Harmony
classlib and DRLVM have tons of warnings or failures when compiled
with VC8. Some are from the code themselves, some are from supporting
codes. The suggested solutions by Microsoft for the security changes
are either to temporarily define _CRT_SECURE_NO_DEPRECATE for
compilation or to use the changed APIs since Microsoft said they
submit the work to standard committee. (Btw, the security changes are
the major part, but there are still warnings/failures caused by other
changes.)

I don't know how other people solve(d) the problem in their Harmony
compilation, but to use `#ifdef' for every call site of the changed
function looks ugly. Probably we could group all those APIs into a
port layer.

Since Microsoft has submitted their work to standard committee, looks
like those safe APIs will soon become standardized [2]. We may finally
have to support them (why not?). Microsoft has tried to produce some
tool that can automatically translate the code to work with the safe
CRT, but this approach doesn't work in many situations. Another
workaround proposed by Microsoft is to overload the original function
with a wrapper function that invokes the safer version, but it doesn't
work for C code.

Since this issue is not specific to Harmony, it's a little bit
surprising that I failed to google much useful information in open
source commuinty. Or I missed something obvious?

Thanks,
xiaofeng

[1] http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/
[2] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1146.pdf

On 7/6/06, Geir Magnusson Jr <geir@pobox.com> wrote:
>
>
> Xiao-Feng Li wrote:
> > It has lots of "secure enhancement" API changes. What's the strategy
> > for those APIs support in Harmony?
>
> Huh?  What APIs in Visual Studio?
>
> geir
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message