c++-cli

Does Mono .NET support and compile C++ / CLI?

早过忘川 提交于 2019-11-27 04:28:58
Does Mono .NET support and compile C++ / CLI? If not, do you know if they have any plans of supporting it? lupus We don't have a compiler for C++/CLI, it would be a very large undertaking for a very small userbase. Consider also that the C++/CLI spec is inherently flawed and non-portable, so being able to compile it wouldn't help much in the general case. You can compile using the MS .NET compiler and run in mono with these restrictions: run with mono on any system if the C++/CLI app is pure managed (but then, why use such an ugly language and not C#?) run with mono on windows in the other

C++/CLI: why should I use it?

[亡魂溺海] 提交于 2019-11-27 04:22:53
问题 I'm pretty familiar with C++, so I considered learning .NET and all its derivatives (especially C#). Along the way I bumped into C++/CLI, and I want to know if there is any specific use for that language? Is it just suppose to be a intermediate language for transforming from native C++ to C#? Another question that popped to my head is why are there still so many programming languages in .NET framework? (VB, C++/CLI, C#...) 回答1: Yes, C++/CLI has a very specific target usage, the language (and

In C++/CLI, how do I declare and call a function with an 'out' parameter?

流过昼夜 提交于 2019-11-27 03:55:23
I have a function which parses one string into two strings. In C# I would declare it like this: void ParseQuery(string toParse, out string search, out string sort) { ... } and I'd call it like this: string searchOutput, sortOutput; ParseQuery(userInput, out searchOutput, out sortOutput); The current project has to be done in C++/CLI. I've tried using System::Runtime::InteropServices; ... void ParseQuery(String ^ toParse, [Out] String^ search, [Out] String^ sort) { ... } but if I call it like this: String ^ searchOutput, ^ sortOutput; ParseQuery(userInput, [Out] searchOutput, [Out] sortOutput);

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

百般思念 提交于 2019-11-27 03:43:30
问题 Visual Studio syntax highlighting colors this word blue as if it were a keyword or reserved word. I tried searching online for it but the word "array" throws the search off, I get mostly pages explaining what an array is. What is it used for? 回答1: 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

How do I convert a System::String^ to const char*?

人盡茶涼 提交于 2019-11-27 03:30:48
问题 I'm developing an app in C++/CLI and have a csv file writing library in unmanaged code that I want to use from the managed portion. So my function looks something like this: bool CSVWriter::Write(const char* stringToWrite); ...but I'm really struggling to convert my shiny System::String^ into something compatible. Basically I was hoping to call by doing something like: if( m_myWriter->Write(String::Format("{0}",someValueIWantToSave)) ) { // report success } 回答1: using namespace System:

boost mutex C++/CLI problems

自闭症网瘾萝莉.ら 提交于 2019-11-27 03:19:04
问题 I'm developing in Visual Studio 2008 C# for 64bit and I want to use to use a library which uses boost. So I wrote a wrapper in C++/CLI. I managed to target the error I get to #include <boost/thread/mutex.hpp>. If I include any file in my C++/CLI wrapper that by itself includes <boost/thread/mutex.hpp> or if I include it directly in the wrapper I get a "System.AccessViolationException" "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I

Cannot pass a GCHandle across AppDomains: solution without delegates?

浪子不回头ぞ 提交于 2019-11-27 02:51:50
问题 I have base library in c++ and client application is in C#. There is c++/cli interface to access c++ api's from C#. Every thing works fine until more than one app domain not come into play like NUnit or WCF hosting i.e. with one app domain. I have stored managed object in gcroot in cli for callback. I have read that this is the root cause of app domain issue ("Cannot pass a GCHandle across AppDomains") because they don't have app domain info (http://lambert.geek.nz/2007/05/29/unmanaged

Visual Studio 2012 failing to detect Visual Studio 2008 build tools

≡放荡痞女 提交于 2019-11-27 02:11:20
问题 I am trying to use Visual Studio 2012 to build a C++ CLI application targeting .NET 3.5. I've already gotten this working on one machine, by installing Visual Studio 2008, and specifying the v90 platform toolset. Now I am attempting this on a new machine, and I've installed Visual Studio 2008, then Visual Studio 2012. Now I get this incredibly frustrating error: Error 81 error MSB8020: The builds tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found. To build using the v90

How to implement a unmanaged thread-safe collection when I get this error: <mutex> is not supported when compiling with /clr

ε祈祈猫儿з 提交于 2019-11-27 01:49:04
I have a C++ application which consists of unmanaged C++, managed C++ and c#. In the unmanaged part I'm trying to create a thread safe collection using std::mutex. However when I use the mutex I get the following error; error C1189: #error : <mutex> is not supported when compiling with /clr or /clr:pure. Any idea why I can't use the mutex? Can someone recommend a replacement for it so that I can create a thread-safe unmanaged collection? It is not supported because the std::mutex implementation uses GetCurrentThreadId(). That's a winapi function that is not supposed to be use in managed code

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

痴心易碎 提交于 2019-11-27 01:41:22
Just wondering if there is a way to use LINQ in C++/CLI. I found one post that was focused on VS 2008 and required a bunch of workarounds for the System::String class. I have seen some framework replacements on CodeProject, but I was wondering if there is a way to use it directly in C++/CLI. If you can, anyone have a good example? 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