c++-cli

VCCodeModel not in VCCodeModel namespace?

I am working with VCCodeModel in both C# and C++ CLR and I am having trouble getting the VCCodeModel type in to the CLR project. I have added Microsoft.VisualStudio.VCCodemodel as a reference, but when I type: Microsoft::VisualStudio::VCCodeModel::VCCodeModel Visual Studio cannot see the code model. All the other objects in the name...

C# and C++ class inheritance intermingling

I have an interesting stack of assemblies I want to put together: Common Assembly (C# or C++) public class MyBase { public void MethodA() { ... } private void MethodB() { ... } protected virtual MethodC() { ... } } Test Code Assemblies (all C++) public class MySpecific : public MyBase{ protected: override MethodC(); }; Test Simulat...

How to initialize unmanaged static pointer in C++/CLI code?

Hi all, thanks for checking my problem:) I'm not able to initialize a static native pointer inside a managed class. Here's the detail: I created a C++/CLI console project and declared a static unmanaged pointer inside. However I can't initialize the static pointer with any means (but if I put the pointer into an anonymous namespace, th...

C++/CLI workaround for implementing a C++ interface

Micropather requires users implement their abstract class "Graph" in order to use the library. What's a good way to do this from C++/CLI so I can use Micropather in .NET? There are only two methods to implement: virtual float LeastCostEstimate( void* stateStart, void* stateEnd ) = 0; virtual void AdjacentCost( void* state, std::vector<...

TryParsing Enums

I am parsing some enum values from a text file. In order to simplify things I am using functions like the following: (The sample code here uses C++/CLI but answers in C# are also welcome.) bool TryParseFontStyle(String ^string, FontStyle% style){ try { FontStyle ^refStyle = dynamic_cast<FontStyle^>( Enum::Parse(FontStyle...

Visual Studio 8: Build Times in mixed-mode assemblies.

I have an C++/CLI assembly consisting of approximately 50 source files. The code in this assembly links statically to a number of C++ libraries to do various 'heavy-lifiting' type tasks. I am using Visual Studio 8 (2005) SP1 to build this assembly. Building just this assembly (without dependencies, etc) via 'Project Only'->'Rebuild On...

Can an ActiveX control in IE download native assemblies it is dependent on

I hope the title of this question makes sense. What I want to know is if I develop an Active X control (developed in C++/CLI) that is dependent on other native (i.e. non-COM) assemblies, will the Active X control work in IE? I.e. will it be able to download the native assemblies locally or is it only the Active X control assembly itself...

Is C++/CLI faster than C#

Is C++/CLI faster than C#? In which type of operations is it faster? Thanks! ...

How do I Forward Declare a Property in C++/CLI?

I have a class in C++/CLI that I'd like to give a property. I want to declare the property in a header file and then implement that property in a .cpp file. Here's the header: public ref class Dude { static property Dude^ instance { Dude^ get(); } } If I declare the header file and don't put anything in the c...

cannot use 'new' on the reference type; use 'gcnew' instead ? in VS 2005

I am using a C++ language I am getting a strange error when I am try to create a simple object of DataTable its giving error System::Data::DataTable* myDataTable = new DataTable(); even I tried this System::Data::DataTable myDataTable = new DataTable(); getting the following error please help. error C2750: 'System::Data::DataTable' :...

How to avoid .dll dependencies under .NET

Hello: I am writing a C++/CLI which have access/"dependencies" to many DLL COM and DLL .NET libraries. Is this possible to link/join all these libraries into my C++/CLI program and generate only one executable object in such a way that I never again have to consider these dependencies every time I have to move my object to another comp...

Can you link your C++ project's dependencies using their .objs (and make a single dll)?

Hello, I have a C++/CLI project in VS 2008 that has a direct dependency on a native C++ library that, in turn, has four additional native C and C++ library dependencies; some of these dependent projects rely on each other as well. I have source code for all of the libraries and can build them all successfully as separate libraries, but ...

Using C# extension methods from managed C++/CLI

Forgive me if my terminology is a little off. My knowledge of managed C++/CLI is very limited. I have an MFC application that uses a dll with the /clr option enabled. This dll uses a couple of C# dlls to communicate with a server using WCF. For the most part this works fine. In one of the C# dlls, I've added an extension method to t...

.NET symbols disappearing from assembly

I have a project that is built with native C++, as well as C++/CLI. I have the following components: Assembly A (C++/CLI) | uses Assembly B (C++/CLI) | uses Static Lib C (Native C++) I did a major re-write of Static Lib C, and it compiles, and other native projects that use it compile fine as well. None of Assembly B changed in t...

C++.Net compile error: "Is not a member of gui::output"

My C++-fu isn't very good and I can't seem to figure out this issue. I have a header file with a typedef in a couple namespaces like so: namespace gui { namespace output { typedef Collections::Generic::List<int> MyTypeDef; } } In a cpp file which includes that header file I have the following code: array<gui::output::MyT...

How to call C# .dll from a C++/CLI application?

I'm trying to call the LumenWorks .csv file reading library from a C++/CLI application and having some issues. I've added a dependancy on LumenWorks.Framework.IO.dll but when I try to then use the library: namespace MyNamespace { using namespace Lumenworks::Framework::IO::Csv; // <My code definitions here> } I get a message ...

Equivalent of ToString() on an enum type in C++/CLI

In C# you can declare an enum and once you have set its value call ToString on the variable and get a string representation of the value of the enum. How do you do this in C++/CLI using a managed enum? ...

C++/CLI ref class using a win32 thread

I'm trying to encapsulate some older win32 code in a C++/CLI ref class to make it better accessible from .NET code. This class needs to start a Win32 thread and pass a pointer to the class as a thread parameter. The code looks something like this: ref class MmePlayer { int StartPlayback() { hPlayThread = CreateThread(NUL...

Access Violation Exception/Crash from C++ callback to C# function.

So I have a native 3rd party C++ code base I am working with (.lib and .hpp files) that I used to build a wrapper in C++/CLI for eventual use in C#. I've run into a particular problem when switching from Debug to Release mode, in that I get an Access Violation Exception when a callback's code returns. The code from the original hpp...

Can I override _matherr in an C++/CLI dll?

I have an unmanaged c++ application that provides a custom _matherr handler. When this application loads and runs code in unmanaged DLLs, if there is a Math error ( e.g. asin( 100.0 ) ) the custom _matherr function is called and everything works. However, I'm now trying to create a NUnit Test DLL in C++/CLI that loads the same unmanage...