How to use LINQ in C++/CLI – in VS 2010/.Net 4.0

You can use the Linq methods that are defined in the System::Linq namespace, but you’ll have to jump through a couple extra hoops. First, C++/CLI doesn’t support extension methods. However, the extension methods are regular methods defined on various classes in System::Linq, so you can call them directly. List<int>^ list = gcnew List<int>(); int i … Read more

Why it is called Marshalling? [duplicate]

Because it’s not the same thing. From Wikipedia: In computer science, marshalling (sometimes spelled marshaling, similar to serialization) is the process of transforming the memory representation of an object to a data format suitable for storage or transmission. It is typically used when data must be moved between different parts of a computer program or … Read more

Implementing an interface declared in C# from C++/CLI

public ref class MyConcreteClass : public IMyInterface { public: virtual void __clrcall Foo(String^ value) sealed; virtual property String^ __clrcall MyProperty { String^ get() sealed { String::Empty; } } }; Interfaces need to be defined as virtual. Also note the “public IMy..” after the class decleration, it’s a slighly different syntax than C#. If you can, … Read more

Why is “array” marked as a reserved word in Visual-C++?

It’s not a reserved word under ISO standards. Microsoft’s C++/CLI defines array in the cli namespace, and Visual Studio’s syntax highlighting will treat it as a reserved word. This usage would be considered a vendor extension and not a part of any international C or C++ standard. ISO C99 Keywords: auto enum restrict unsigned break … Read more

C++/CLI wrapper for native C++ to use as reference in C#

Ok, tutorial. You have a C++ class NativeClass that you want to expose to C#. class NativeClass { public: void Method(); }; 1) Create a C++/CLI project. Link to your C++ library and headers. 2) Create a wrapper class that exposes the methods you want. Example: #include “NativeClass.h” public ref class NativeClassWrapper { NativeClass* m_nativeClass; … Read more

warning MSB8028: The intermediate directory (Debug\) contains files shared from another project

Same problem here, solved by Deleting all Debug\ and Release\ folders (there were more of them in subfolders where I didn’t expect them) Changing the .sln file manually to fix the name of a referenced C++ project (.vcxproj) which apparently was not renamed when renaming the project in Visual Studio

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)