[Connect bug] VC++ 2010 : C++/CLI does not support variant delegates/interfaces
-
I've used it a little, though to be honest, I mostly try and skip .NET altogether and stick with C++ for most of my needs.
I also work mostly in C++. I do maintain a .NET library that interfaces with our core DLLs (with C entry points.) (For our XP embedded based system, I deliberately tried to write two utilities in .NET and abandoned the effort due to lack of support in the framework for what I needed to do. On top of that, the .NET version for one utility was over 10x bigger than the native version [and it wasn't even done!] and when pushing updates over cell that's a very big deal. One key utility was done in .NET and sometimes I want to strangle the guy who did that.)
-
I've found it very useful for interop between Managed (C#,etc.) and legacy unmanaged C++ code. It's much more efficient than COM interop, and more flexible than pInvoke for scenarios where COM interop is not a choice). I would not use it for anything more significant than a thin interop layer, however.
We are also using it like a middle tier when extending a MFC application with C#.
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
-
I posted that a day back. If any of you do use C++/CLI and this is an issue that you think is serious enough to require quick resolution, please vote the issue up. A higher number of votes will help them prioritize on the time/resources they want to spend on this issue. Thank you. To summarize, C++/CLI has not been updated to support variance in delegates and interfaces. C# 4.0 supports this and this limitation in C++/CLI will bring down its utility as an interop language. The following code does not compile in C++/CLI today, though the equivalent C# code will compile.
ref class Base {};
ref class Derived : Base {};
int main(array<System::String ^> ^args)
{
return 0;
}void FooInterfaces()
{
IEnumerable<Base^>^ base = gcnew List<Base^>();
IEnumerable<Derived^>^ derived = gcnew List<Derived^>();
base = derived; // <-- Error C2440 here
// IEnumerable<> is covariant so this should compile and does so in C# 4.0
}generic<typename T> void ShowItem (T item, Action<T>^ showFunc)
{
showFunc(item);
}void ShowBase(Base^ b) { }
void FooDelegates()
{
Derived^ d = gcnew Derived();
ShowItem<Derived^>(d, gcnew Action<Derived^>(ShowBase)); // <-- Error C3352 here
// Action<> is contravariant and this compiles in C# 4.0
}Thank you.
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
I've voted there (I'm not using c++/cli though).
It's time for a new sig. Seriously.
-
I've voted there (I'm not using c++/cli though).
It's time for a new sig. Seriously.
Thank you :thumbsup:
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
-
Other than Nish, here on CP, and myself, I don't know a soul who has written any C++/CLI code, even to try it out. I've written some C++/CLI code, just to see what it could do. Wasn't impressed and found the lack of interest by Microsoft to document and help you along to be a major show stopper. (If you've written C++/CLI, that makes three.)
Joe Woodbury wrote:
Other than Nish, here on CP, and myself, I don't know a soul who has written any C++/CLI code, even to try it out. I've written some C++/CLI code, just to see what it could do. Wasn't impressed and found the lack of interest by Microsoft to document and help you along to be a major show stopper. (If you've written C++/CLI, that makes three.)
I used it for a project. I had a c++ core library to talk to a data source and then a code generator that made c++ and c++/cli classes to encode / decode different protocols. That code was then used to build c++ and c# clients of the data source. The main advantage was the core c++ library was reused by the c# clients as it was statically linked to the cli code library. It was even used on linux with mono.
-
Thank you :thumbsup:
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
For not using it? Why, is it the CLI in low supply these days? :-D
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
-
For not using it? Why, is it the CLI in low supply these days? :-D
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
Deyan Georgiev wrote:
For not using it? Why, is it the CLI in low supply these days?
Yeah big joke, funny guy! :rolleyes:
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
-
I've voted there (I'm not using c++/cli though).
It's time for a new sig. Seriously.
Rajesh R Subramanian wrote:
I've voted there
It's kinda sad how few people here did the same. It's only at 9 votes now and was 4 before I cast mine. The entire point of posting connect bug reports here is the I'll Scratch Your Back If You Scratch Mine Principle. It all falls apart if we don't vote each other's bugs to the TEOTWAWKI level necessary to have MS patch them in the next major release.
3x12=36 2x12=24 1x12=12 0x12=18
-
Other than Nish, here on CP, and myself, I don't know a soul who has written any C++/CLI code, even to try it out. I've written some C++/CLI code, just to see what it could do. Wasn't impressed and found the lack of interest by Microsoft to document and help you along to be a major show stopper. (If you've written C++/CLI, that makes three.)
/me puts his hand up. I've used it to expose .Net objects in Tcl, i.e. .Net Tcl extensions plus things that look like object. It astonished me just what a piece of engineering C++/CLI was. I couldn't believe it all worked as advertised. Typing with a baby in one hand is slow.
-
/me puts his hand up. I've used it to expose .Net objects in Tcl, i.e. .Net Tcl extensions plus things that look like object. It astonished me just what a piece of engineering C++/CLI was. I couldn't believe it all worked as advertised. Typing with a baby in one hand is slow.
Phil Martin... wrote:
Typing with a baby in one hand is slow.
Typing while holding a toddler who thinks keyboards are great fun is ever slower.
-
Rajesh R Subramanian wrote:
I've voted there
It's kinda sad how few people here did the same. It's only at 9 votes now and was 4 before I cast mine. The entire point of posting connect bug reports here is the I'll Scratch Your Back If You Scratch Mine Principle. It all falls apart if we don't vote each other's bugs to the TEOTWAWKI level necessary to have MS patch them in the next major release.
3x12=36 2x12=24 1x12=12 0x12=18
Some of us aren't under the delusion that Microsoft actually fixes anything on Connect based on any meaningful criteria. (Heck, there's a bug in Visual Studio 2010 that has something like 60 votes and Microsoft still pretends it doesn't happen.)
-
Deyan Georgiev wrote:
For not using it? Why, is it the CLI in low supply these days?
Yeah big joke, funny guy! :rolleyes:
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
Don’t play sarcastic on me or I’ll stop hammering at my boss that we need a copy of your “Extending MFC applications with C#”. :-D
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
-
Don’t play sarcastic on me or I’ll stop hammering at my boss that we need a copy of your “Extending MFC applications with C#”. :-D
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
Deyan Georgiev wrote:
Don’t play sarcastic on me or I’ll stop hammering at my boss that we need a copy of your “Extending MFC applications with C#”.
:laugh: Alright, but you've gotta get your boss to buy a copy for each developer there!
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
-
Rajesh R Subramanian wrote:
I've voted there
It's kinda sad how few people here did the same. It's only at 9 votes now and was 4 before I cast mine. The entire point of posting connect bug reports here is the I'll Scratch Your Back If You Scratch Mine Principle. It all falls apart if we don't vote each other's bugs to the TEOTWAWKI level necessary to have MS patch them in the next major release.
3x12=36 2x12=24 1x12=12 0x12=18
Dan Neely wrote:
It's kinda sad how few people here did the same. It's only at 9 votes now and was 4 before I cast mine. The entire point of posting connect bug reports here is the I'll Scratch Your Back If You Scratch Mine Principle. It all falls apart if we don't vote each other's bugs to the TEOTWAWKI level necessary to have MS patch them in the next major release.
Yeah I was kinda hoping for a few more votes than this really. I think it's the need to sign in using a .NET Passport that makes people think it's too much hassle :sigh:
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
-
Some of us aren't under the delusion that Microsoft actually fixes anything on Connect based on any meaningful criteria. (Heck, there's a bug in Visual Studio 2010 that has something like 60 votes and Microsoft still pretends it doesn't happen.)
In my experience, the VC++ team has been quite responsive to compiler issues. If they've given anything a pass, it's usually been due to time constraints.
Regards, Nish
Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application
-
Phil Martin... wrote:
Typing with a baby in one hand is slow.
Typing while holding a toddler who thinks keyboards are great fun is ever slower.
Tell me about it. My 3 year old is fascinated by computers (and rightly so) and just loves me opening up a work processor and letting her type out the alphabet and some numbers and words and things. I'm sure she'll be using Twitter and FriendFace well before me too.
-
I've found it very useful for interop between Managed (C#,etc.) and legacy unmanaged C++ code. It's much more efficient than COM interop, and more flexible than pInvoke for scenarios where COM interop is not a choice). I would not use it for anything more significant than a thin interop layer, however.
I've used it to interop with "legacy" static libraries (.lib). Legacy meaning vendors who think people still use VC 6.0, and provide C++ libraries as their only interop.
-
Other than Nish, here on CP, and myself, I don't know a soul who has written any C++/CLI code, even to try it out. I've written some C++/CLI code, just to see what it could do. Wasn't impressed and found the lack of interest by Microsoft to document and help you along to be a major show stopper. (If you've written C++/CLI, that makes three.)