c++-cli

what's the difference between a CPP/CLI assembly and a CS/VB assembly?

I do know some "basic" differences but there are still some questions in my mind: What's their difference in performance at runtime? //This I really wanna know. Why can't you build a MSIL assembly using C++/CLI? What's the PE code (Not the .NET's PEKind) of a MSIL/CIL assembly? (C++/CLI assemblies have the same PE Code than unmanaged b...

Where's _WIN64 defined in C++/CLI project compiled as x64?

It seems to be added automagically in every project I create and I compile for x64 but it doesn't even appear in the project's Configuration Properties/(C/C++)/Preprocessor when selecting the x64 configuration. ...

Why is /clr incompatible with /mt and /mtd in Visual Studio?

Hi can anybody please explain for me how and why /clr is incompatible with /mtd ? What is the alternative for this? What happens internally if I use /md or /mdd ? As far as I know we don't combinedly use /clr and /mtd. Can someone explain if there is a way to do this? And please explain me how and why /clr is incompatible with /mt and ...

.NET for a legacy VC++ 6.0 developer

What are some of the best books/approaches to learn .NET for a legacy VC++ 6.0 developer? I am hesitant to learn a new language like C# or VB.NET for various reasons. I am experienced in C++/Win32 programming. I am more inclined towards learning C++/CLI to get hands on .NET development experience. Is this a good approach? What did you do...

C++\CLI exception specification not allowed

I'm an experienced unmanaged C++ developer, new to C++\CLI. How come managed C++ doesnt allow exception specification? Example link What's the best practice for specifying exceptions my methods throw then? ...

Insert empty BLOB into SQLite DB using ODBC and C++ Net

I'm using a SQLite database to store cover images of books I have in a database. I've got the inserting of BLOBs ok, but when I don't have a cover image for my book I can't seem to get it to insert a null BLOB. I'm using parameters for my insert SQL statement, using ODBC, as shown below: OdbcParameter^ paramCoverImage = gcnew OdbcParam...

C++/CLI Converting from System::String^ to std::string

Can someone please post a simple code that would convert System::String^ to C++ std::string ? i.e I just want to assign the value of String^ originalString; to std::string newString; ...

C++ CLI candidate function(s) not accessible

I'm new to C++ CLI coming from unmanaged C++ world. I'm getting this error: candidate function(s) not accessible when I pass a std::string as part of the method argument. Here's the exact code: Lib Project (compiled as .dll project) //Lib.h #pragma once public ref class Lib { public: Lib(void); public: void Extract( std::st...

how to define interfaces in managed c++/c++

Hi Can we define interfaces in c++ using visulastudio? if yes plz help me in defining interfaces in c++ with example... Thanks in advance ...

Can C++/CLI yield?

In C#, I can use the yield keyword to implement a generator, viz: int GenInt() { for(int i = 0; i < 5; i++) yield return i; } Then, calling the function multiple times will return 0 through 4. Can the same thing be done in C++/CLI? There's no yield keyword, so my gut reaction is that there isn't, which sucks, but what ...

How to exclude MFC code from VS2008 Code Analysis

I have a C++/CLI project that uses CWinFormsControl and CWinFormsView to create .NET controls in my MFC views. To do this I need to #include "afxwinforms.h". When I run Code Analysis on the project, I always get warnings about some of the MFC classes I've included. Examples: 3>Running Code Analysis... 3>c:\program files\microsoft visua...

Why is PERSON not a ref class???

I don't understand why compiler thinks PERSON is NOT a ref class: : error C2811: 'Runner' : cannot inherit from 'Person', a ref class can only inherit from a ref class or interface class I tried.... adding mscorlib.dll to the header files: #using..etc...<> - didn't work. making Person an abstract class - didn't work (Im gla...

C++ / CLI - Change all files to UNMANAGED by default

Does anyone know how to change the default behavior of the /clr switch to make all files unmanaged by default? The default behavior of the switch is to make all files managed. I know I can mark each .cpp file individually, but there are ALOT of them... ...

Did I read somewhere that C++/CLI moves us towards a "header-file" less society, like Java.

And if so, should I be trying to keep header file use to a minimum when creating classes? thx ...

How do I declare a method in C++/CLI that will be seen as an extension method in C#?

I'm writing a .NET assembly in C++/CLI to be used in our C#-based application. I'd like the application to see some of the C++ methods as extension methods. Is there some attribute I can apply to the declaration to specify that a method should be seen as an extension method from C#? ...

How do I override < and > in C++/CLI?

I'm porting a class which implements IEquatable<T> and IComparable<T> and overrides ==, !=, < and > from C# into C++/CLI. So far I have: Header: virtual bool Equals(Thing other); virtual int CompareTo(Thing other); static bool operator == (Thing tc1, Thing tc2); static bool operator != (Thing tc1, Thing tc2); static bool operator > (...

Improvements to C++/CLI in .NET framework releases

There have been substantial features and improvements in C# with each new release of the .NET framework, and in the upgrade from .NET1.0 to .NET2.0, Managed C++ was replaced with C++/CLI, which was a great improvement. Have there been any improvements in C++/CLI since .NET2.0? ...

CLR \ CLI Com Object Out of process Server.

How do you register a COM object written in Managed C++ to be SingleUse? Regasm does not appear to have the option. I am guessing it may be a s simple as defining an attribute in AssemblyInfo.cpp but I can't find it. I have written a VB6 ActiveX EXE and it works as I want it to - that is every request for an Interface creates a new runn...

How do I forward declare a delegate in C++/CLI?

How? The following did not work: delegate MyDelegate; ref class MyDelegate; delegate void MyDelegate; The following works for declaration: public delegate void MyDelegate(Object ^sender, MyArgs ^args); But using it as a forward declaration gives me error C3756: 'MyNameSpace::MyDelegate': delegate definition conflicts with an exi...

0xE0434F4D Error

Hello, all, I have a rather frustrating issue. The application in question has an MFC GUI that uses the classes available in the MFC Featurepack. This GUI uses an DLL that is developed in C++\CLI. Our company uses Cruise Control. NET (1.4.4 SP1) on Windows Server 2008 SP2 for continuous integration. Cruise Control is setup to use the ...