开发者

C++/CLI Community

开发者 https://www.devze.com 2023-02-20 10:46 出处:网络
Sort of curious as to how many pe开发者_高级运维ople actually use C++/CLI? So how many people are using it? Are there specific jobs that people are only looking for programmers under a managed environ

Sort of curious as to how many pe开发者_高级运维ople actually use C++/CLI? So how many people are using it? Are there specific jobs that people are only looking for programmers under a managed environment? How big is the community around c++/cli? From what I've seen thus far there are quite a few syntax changes, is this something I should learn, as a c++ programmer? Also, is c++/cli, c++.net? I'm pretty ignorant to anything microsoft.


Just about nobody makes a living programming in C++/CLI every day. Plenty of programmers know how to write a wrapper class, that's what the language is great at. But these are one-off projects, bridging the gap between a legacy codebase and a managed front-end. Much like it is used in the .NET framework, C++/CLI is used in System.Data and PresentationManager to interop with respectively dbase providers and DirectX.

When you know native C++ programming well and have at least been exposed to something like C# and know the fundamentals of the CLR then you'll have little trouble diving in when necessary. Figure about three weeks to get up to speed on the syntax. Mastering it takes longer of course, but not always necessary to get the job done.


Starting with some of the easier parts of your question first, "Managed C++" is the name of the older interoperability layer for C++ introduced in Visual C++ 2002. To be honest, it was pretty horrible and put me off bothering to look at .Net for ages. For Visual Studio 2005, Managed C++ was replaced by C++/CLI. The syntax is actually pretty straightforward and whilst the final result doesn't exactly look like C++, it's easy to read and it's very similar to C#. Nailing my colours firmly to the mast, I actually quite like using it!

Most use cases of C++/CLI involve wrapping native code, and apart from using for this, I've also used it for a more substantial assembly involving Extended MAPI and Outlook.

In terms of day to day usage of C++/CLI, you'll probably want to take a long hard look at how the dispose pattern should be implemented (look at the ~/! syntax combination). I do find it irritating that boost shared pointers can't be used as member variables in managed classes, so I've been writing my only "delete" statements in years, but it's a small point really.

FxCop works brilliantly on C++/CLI generated assemblies, so you should definitely make use of this as you learn about .Net.

Best of luck!

p.s.

Strictly speaking, I'm not sure this question qualifies as being a valid StackOverflow question, but it is an interesting subject...


C++ / CLI is definitely a niche, but I'm sure developers don't have a hard time finding work. The purpose of C++ / CLI is to bridge the gap between native and managed code. The Microsoft Visual C++ compiler will compile native C++, managed C++ ( CLI ) or both at the same time. It's definitely useful for Interop scenarios where performance is important.

If you're interested in learning more check out:

http://www.functionx.com/cppcli/index.htm


C++/CLI is necessary to help bridge between managed and unmanaged code, when you don't have the complete luxury of writing in 100% managed. This can happen if you can't rewrite your entire C++ app in managed code, due to numerous constraints, and so adding new managed code in bits and pieces over time is a way to do a realistic migration to getting managed code.

0

精彩评论

暂无评论...
验证码 换一张
取 消