Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. [Connect bug] VC++ 2010 : C++/CLI does not support variant delegates/interfaces

[Connect bug] VC++ 2010 : C++/CLI does not support variant delegates/interfaces

Scheduled Pinned Locked Moved The Lounge
helpcsharpwpfcomc++
28 Posts 14 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Matt Gullett

    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.

    E Offline
    E Offline
    El Corazon
    wrote on last edited by
    #9

    Matt Gullett wrote:

    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.

    you and me both. :-D

    _________________________ John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others." Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....

    1 Reply Last reply
    0
    • J Joe Woodbury

      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.)

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #10

      Well, yeah... It's easily the worst-supported (official) .NET language out there, so it doesn't get talked about much. At this point, I'm not interested in doing major work in a language that MS apparently wishes would die... But, it beats P/Invoke, so in the boundary between the C++ app and .NET components it has a home.

      1 Reply Last reply
      0
      • M Matt Gullett

        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.

        J Offline
        J Offline
        Joe Woodbury
        wrote on last edited by
        #11

        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.)

        1 Reply Last reply
        0
        • R Rob Graham

          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.

          S Offline
          S Offline
          Single Step Debugger
          wrote on last edited by
          #12

          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.

          1 Reply Last reply
          0
          • N Nish Nishant
            • Link to Connect bug[^]

            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

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #13

            I've voted there (I'm not using c++/cli though).

            It's time for a new sig. Seriously.

            N D 2 Replies Last reply
            0
            • R Rajesh R Subramanian

              I've voted there (I'm not using c++/cli though).

              It's time for a new sig. Seriously.

              N Offline
              N Offline
              Nish Nishant
              wrote on last edited by
              #14

              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

              S 1 Reply Last reply
              0
              • J Joe Woodbury

                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.)

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #15

                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.

                1 Reply Last reply
                0
                • N Nish Nishant

                  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

                  S Offline
                  S Offline
                  Single Step Debugger
                  wrote on last edited by
                  #16

                  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.

                  N 1 Reply Last reply
                  0
                  • S Single Step Debugger

                    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.

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #17

                    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

                    S 1 Reply Last reply
                    0
                    • R Rajesh R Subramanian

                      I've voted there (I'm not using c++/cli though).

                      It's time for a new sig. Seriously.

                      D Offline
                      D Offline
                      Dan Neely
                      wrote on last edited by
                      #18

                      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

                      J N 2 Replies Last reply
                      0
                      • J Joe Woodbury

                        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.)

                        P Offline
                        P Offline
                        Phil Martin
                        wrote on last edited by
                        #19

                        /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.

                        J 1 Reply Last reply
                        0
                        • P Phil Martin

                          /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.

                          J Offline
                          J Offline
                          Joe Woodbury
                          wrote on last edited by
                          #20

                          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.

                          P 1 Reply Last reply
                          0
                          • D Dan Neely

                            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

                            J Offline
                            J Offline
                            Joe Woodbury
                            wrote on last edited by
                            #21

                            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.)

                            N 1 Reply Last reply
                            0
                            • N Nish Nishant

                              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

                              S Offline
                              S Offline
                              Single Step Debugger
                              wrote on last edited by
                              #22

                              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.

                              N 1 Reply Last reply
                              0
                              • S Single Step Debugger

                                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.

                                N Offline
                                N Offline
                                Nish Nishant
                                wrote on last edited by
                                #23

                                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

                                1 Reply Last reply
                                0
                                • D Dan Neely

                                  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

                                  N Offline
                                  N Offline
                                  Nish Nishant
                                  wrote on last edited by
                                  #24

                                  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

                                  1 Reply Last reply
                                  0
                                  • J Joe Woodbury

                                    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.)

                                    N Offline
                                    N Offline
                                    Nish Nishant
                                    wrote on last edited by
                                    #25

                                    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

                                    1 Reply Last reply
                                    0
                                    • J Joe Woodbury

                                      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.

                                      P Offline
                                      P Offline
                                      Phil Martin
                                      wrote on last edited by
                                      #26

                                      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.

                                      1 Reply Last reply
                                      0
                                      • R Rob Graham

                                        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.

                                        R Offline
                                        R Offline
                                        Rick Shaub
                                        wrote on last edited by
                                        #27

                                        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.

                                        1 Reply Last reply
                                        0
                                        • J Joe Woodbury

                                          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.)

                                          B Offline
                                          B Offline
                                          bjarneds
                                          wrote on last edited by
                                          #28

                                          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 used it - because I had to. See .NET Object Spy and InvokeRemote[^].

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups