Thread: C++/cli

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    C++/cli

    Can somebody please explain to me what CLI is?
    When I write a C++ program with CLI it will be compiled by a C++/CLI compiler to a code different from a pure C++ compiler? Does it add overheads to the code?
    What is managed code?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Managed C++ is a way to combine C++ code with .NET. To compile the programs you had with VC 6, you should pick Win32 projects, not .NET projects so you don't have to deal with CLI or managed code. You can also turn off the option in the project properties.

  3. #3
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    So C++ is still C++? I don't have CLI compiler yet.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    With a .NET compiler (VC++ version 7.0 or greater, 2002 or higher) you can compile regular C++ without the CLI features. You can also do it with the CLI. It is your choice. Most of the people in this forum don't use the CLI, so generally the code we write here would belong in Win32 projects instead of .NET projects, which is what I was referring to earlier.

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    88
    I'm on VS.NET 2003. That calls this common language runtime - with the comiler option /clr. I only noticed it yesterday, but after switching it off my binary went down from 22 to 2MB and runtimes have increased between 5x (at the very slowest) and 100x (averaging about 80x speed increase). God knows why. I wasn't even using any managed extension code.

  6. #6
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    vs.net 2002/3 don't support the full version of C++/CLI. CLI actually adds extra operators to the language (using ^ as a garbage-collected "handle", instead of a pointer). vs 2002/3 support "managed c++" which is an ugly hack to get .net support in C++. if you want to interoperate between C++ and .net, my advice is to get vs 2005.

    Although I can't speak from personal experience, from what I've heard C++/CLI is actually quite nice to use.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  7. #7
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    New posts came when I was writing this post .
    Last edited by siavoshkc; 03-07-2006 at 05:53 AM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  8. #8
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    I understood that we can write C++ code in C++/CLI environment. But can somebody please explain to me what CLI is? Is it something like Java VM?
    Can Micro$oft force programmers to write only .net/CLI code for windows in the future?
    I like C++ because I know what I am doing and it does what I've told it. But with CLI you don't know what is going on.
    Micro$oft said "CLI is very efficient, C++, C#, VB, etc will work at the same speed because they all will use CLI.". Yes because all of them will work as slow as a BASIC code on an 386 machine. If somebody want to write CLI she can go for C# or VB. What C++/CLI means to exist?
    Microsoft also said "Creating C++/CLI from C++ is like creating C++ from C.". What do you think?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  9. #9
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    Since Microsoft controls Windows, not Micro$oft (whoever they are), Micro$oft will never be able to force you to use .NET/CLI instead of native Win32 (or Win64 at that time).

    Of course Microsoft could decide to drop Win32/Win64 support from the operating system, but they'd be shooting themselves in the foot as it would prevent the vast majority of existing applications (including many of their own) from working anymore.

    You can still run 16 bit Windows and even DOS applications in Windows XP today, applications written 10-20 years ago.
    I'd not worry overly much about some evil genius stealing Windows and changing it so that everything that's not a .NET assembly fails to work.

  10. #10
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    I don't know about Win64, but there is something named WinFX. I don't know how it works exactly. But Micro$oft likes to do the hard part of programming for programmers and tries to make things very easy for programmers. It satisfies at least two goals:
    1) All developers will be more dependent to Micro$oft.
    2) Micro$oft can handle the compatibility problems and bugs more easily.

    Running old programs has nothing to do with my problem (Does Vista support them?). What if microsoft realesed a C++/CLI compiler that only supported .net? Yes their OS will still support Win32, but because many programmers use Microsoft compilers, they wont produce a non-CLI code. So after 6 years from that time, Micy can make an OS without support of Win32, Win64, WinFX, etc. Only CLI and .net are supported then.

    I'd not worry overly much about some evil genius stealing Windows and changing it so that everything that's not a .NET assembly fails to work.
    What do you mean?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  11. #11
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    what Micy does equally doesn't matter...
    It's only what Microsoft does that matters.
    Their compilers now haven't supported DOS for over a decade yet you can still run DOS programs on the latest version of Windows...

    Your support for piracy is only outstripped by your hatred for Microsoft it seems yet you still insist in using their products.
    If you hate them so much be a man and do without their products.

  12. #12
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    you know, as soon as you said "Micro$oft", I lost all interest in helping you.
    get off your ass, go to msdn and RTFM! then come back a little more educated.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  13. #13
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    I don't hate Microsoft, I like it. If there was no Microsoft there was no PC I think. But it sometimes do some works just for keeping it's supriority. It is good to read:
    http://www.madore.org/~david/computers/antims.html

    Their compilers now haven't supported DOS for over a decade yet you can still run DOS programs on the latest version of Windows...
    Yes, it is exactly what I said. There can be support for Win32, but no support for developing it.
    Your support for piracy is only outstripped by your hatred for Microsoft it seems yet you still insist in using their products.
    Becareful of what you are saying I don't support any kind of piracy. I am not happy that there is no copyright law here because it is bad for a developer. I wish you understand this.
    Last edited by siavoshkc; 03-07-2006 at 02:54 PM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  14. #14
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    yet you're using software which you under US export restrictions should have no access to... That means that software must be pirated and you must know that.
    Your attempts to be seen as a 1337 k3w1 hax0r also don't make you look better...

  15. #15
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    This is US export restriction not Iran import restriction.
    What is 1337 k3w1 hax0r then?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

Popular pages Recent additions subscribe to a feed