[cfe-dev] C++/CLI (Ecma 372) support in Clang

Cesar Mello cmello at gmail.com
Fri Jul 20 09:29:50 PDT 2012


For Windows 8 the WinRT projections for .NET and C++/CX seem to replace
C++/CLI.

http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-690C

Best regards
Mello



On Fri, Jul 20, 2012 at 10:20 AM, João Matos <ripzonetriton at gmail.com>wrote:

> > It's a fairly extensive and complicated extension to C++, and it seems
> unlikely that Clang will ever actually be a useful C++/CLI compiler.
> Moreover, the advent of C++/CX and the recent push toward native code makes
> the long-term future of C++/CLI completely unclear, and I'd rather not have
> us chasing yesterday's technology.
>
> Native and managed code have different advantages, so I don't see
> managed code getting replaced by native code soon. What I see is
> native code being used for the lower level parts of software where
> performance really matters, with a managed layer for extensibility-
> and C++/CLI is the bridge. I do get your point though, and agree that
> the drawbacks might outweigh the benefits.
>
> > C++/CX seems like a more reasonable goal for Clang as a project, because
> (1) it's more conceivable that we could actually provide a useful C++/CX
> compilation environment, and (2) it seems to be the new direction for
> Microsoft. Plus, I think it might be a little smaller and, therefore,
> slightly easier to implement.
>
> In terms of complexity, they both seem really similiar syntax-wise. MS
> has re-used most of their previous work on C++/CLI for C++/CX, here is
> a summary of differences:
>
> Basic types:
>  CLI: From mscorlib.dll (System::* types)
>  CX:  From vccorlib.dll (Platform::* types)
>
> Lifetime management:
>  CLI: Garbage collected
>  CX:  Refcounted
>
> Cycles Broken:
>  CLI: By garbage collector
>  CX:  Broken by user (weak references or explicit delete)
>
> Code generation:
>  CLI: MSIL + native code. Can create a cross-platform binary if MSIL-only.
>  CX:  Native code only. Binaries target a specific platform.
>
> Object Creation:
>  CLI: gcnew
>  CX:  ref new
>
> interior_ptr:
>  CLI: Supported
>  CX:  Not supported
>
> pin_ptr:
>  CLI: Supported
>  CX:  Not supported
>
> V% (% when it refers to a byref (kind'a like an "interior_ref") ):
>  CLI: Supported
>  CX:  Not supported
>
> R% (% when it refers to an implicitly dereferenced ref type):
>  CLI: Supported
>  CX:  Supported
>
> Ref to ^:
>  CLI: R^%
>  CX:  R^&
>
> Boxing:
>  CLI: syntax V^
>  CX:  IReference<V>^
>
> Dereferenced box type:
>  CLI: V%
>  CX:  const V
>
> Generics:
>  CLI: Generics classes, interfaces & delegates allowed.
>  CX:  Generic interfaces & delegates only.
>
> Static constructors:
>  CLI: Supported
>  CX:  Not supported
>
> Address of member of ref class:
>  CLI: Returns an interior_ptr
>  CX:  Returns a type*
>
> friends:
>  CLI: Not supported
>  CX:  Supported
>
> C++ class embedded in ref class:
>  CLI: Not supported
>  CX:  Supported
>
> ref class embedded in C++ class:
>  CLI: Not supported
>  CX:  Supported (R-on-stack)
>
> ^ embedded in C++ class:
>  CLI: Not supported (Needs GCHandle)
>  CX:  Supported
>
> ^ embedded in value class with value class on native heap:
>  CLI: Not supported
>  CX:  Supported (for String^)
>
> Global ^:
>  CLI: Not supported
>  CX:  Supported
>
> Global R-on-stack:
>  CLI: Not supported
>  CX:  Supported
>
> Finalizer:
>  CLI: Supported
>  CX:  Not supported
>
> Destructor:
>  CX:  Runs on IDisposable::Dispose (delete / stack unwind) only
>  CLI: Runs on IDisposable::Dispose (delete / stack unwind) -or- last
> release (never both)
>
> T::typeid:
>  CLI: Supported
>  CX:  Not supported
>
> --
> João Matos
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120720/d22ff994/attachment.html>


More information about the cfe-dev mailing list