I have actually been looking into this.  Essentially all core EDK II headers 
need to have the #ifdef cplusplus wrapper added.  Many files in StdLib have 
this wrapper but not all, and some of those that do need to be a bit more 
inclusive.

A toolchain definition that uses the C++ compiler, and treats the .h and .c 
files as c++, needs to be added to Conf\tools_def.txt.

Even after this has been done, you are still restricted to a subset of C++.  
Otherwise, the compiler will emit calls to runtime library functions that don't 
exist when building for EDK II.

If you have the discipline to stick with a subset of the language, then these 
changes are beneficial.  Unfortunately, mapping which features may or may-not 
be used is time intensive.  I have found a couple places where the difference 
between how C and C++ handle const cause problems with some supported compilers 
but not others.

This isn't a very practical subset, but it is possible to build trivial 
programs, using a C++ compiler, after just wrapping most of the headers in the 
MdePkg.

Then, of course, there is the issue of coming up with solutions that work for 
all supported compilers and all supported CPU architectures, is maintainable, 
and does not add an undue burden to other developers.

I think supporting C++ compilers, though not necessarily the language, would be 
a good thing.  Because of the issues listed above, and others, this is not 
something to be undertaken lightly.

Daryl McDaniel


From: Igor Sharovar [mailto:[email protected]]
Sent: Wednesday, February 06, 2013 12:14 PM
To: [email protected]
Subject: Re: [edk2] Fix for stdlib and cpp building.

Is it possible to see a list all projects, which must be completed, to support 
cpp in edk?
Thanks
Igor

On Mon, Feb 4, 2013 at 6:00 PM, Jordan Justen 
<[email protected]<mailto:[email protected]>> wrote:
On Mon, Feb 4, 2013 at 3:16 PM, David F. 
<[email protected]<mailto:[email protected]>> wrote:
> Since you can't commit changes ... Here's a patch file that corrects the bug
> in the gdtoaimp.h and tdtoa.h headers on X64 builds and corrects issues that
> prevent a CPP build.
Please review StdLib/Contributions.txt for details on how to submit a
contribution to StdLib.

Thanks,

-Jordan

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to