2
голосов
4ответов
6908 просмотров

C++/CLI: Boxing and Generic Lists

I am trying to create a generic list of references to PointF objects. (No, I am not looking to create a generic list of PointF objects.) However, the following line fails to compile: Generic::List<PointF^> ^pointList; // Generates error C3225 On the other hand, creating an array of Point...

1
голосов
1ответов
578 просмотров

Avoid loading .Net Dlls in a C++/CLI project?

I have a project written in C++/CLI. Some of the types there are in managed code, and some are in completely native code. Let's say I have the produced DLL on a machine that dosen't have any version of the .Net framework installed, is there a way that another, native application will link with my...

0
голосов
1ответов
1743 просмотров

Passing a reference of an handle in C++/CLI

I want to delete a 2 level derived class with a function and putting its handle to null. A piece of code will be helpfull: ref class bob { }; ref class bill : public bob { }; ref class jack : public bill { }; void DeleteX( bob ^% x ) { if( x != nullptr ) { delete x; x = nullptr; ...

0
голосов
2ответов
938 просмотров

Measuring application startup performance

I'm using C++/CLI on Windows. It's an MFC app built with /clr. I want to test how long it takes my application to start up. The first time it took 10s, but subsequently it took 4s, 4s, 5s. I'm assuming this is due to Windows caching the DLLs. Is there some tool that will allow me to remove a di...

0
голосов
1ответов
2231 просмотров

C++/CLI Managed Wrapper and ADODB::Recordset

I have a native C++ DLL that uses COM ADO Recordsets and am in need of converting it to the .NET variant (ADODB::Recordset). I have tried several approaches to tackling this problem without success. The native C++ DLL dynamically creates and populates the COM Recordset. Ideally I'd do the same ...

0
голосов
2ответов
1776 просмотров

translating C++/CLI code to C#

I'm trying to translate this c++/cli code to c# #pragma once #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <tchar.h> using namespace System; using namespace System::Runtime::InteropServices; struct CREDENTIAL { DWORD Flags; DWORD Type...

4
голосов
1ответов
557 просмотров

How does c++/cli work internally with unmanaged parts?

How does it work? Does it have distinct parts - some methods are managed, some are unmanaged, does it convert every method to managed, trying to keep everything managed and doing the interop calls when he must?

5
голосов
1ответов
1235 просмотров

Why does the C++/CLI compiler get confused so easily with symbols?

Here is my code: using namespace System; using namespace System::Collections; using namespace System::Collections::Generic; namespace Tests { ref class MyCollection : public IEnumerable<int> <----HERE! The C# compiler, for instance, will recognize that the only IEnumerable<T&g...

4
голосов
2ответов
1854 просмотров

How to implement IEnumerable<int> from this c# code?</int>

I'm trying to convert this c# code into c++/cli code: class MyRange : IEnumerable&lt;int&gt; { public IEnumerator&lt;int&gt; GetEnumerator() { return null; } IEnumerator IEnumerable.GetEnumerator() { return null; } } Here is my attempt: namespace Tests { public ref class MyRange ...

0
голосов
2ответов
99 просмотров

How to make my class implement from IMyInterface<t>?</t>

I want to port the following code from c# to c++/cli: class MyClass : IEnumerable&lt;int&gt; { ... } I've tried class ref class MyClass : IEnumerable&lt;int&gt; but it doesn't seem to be working.

2
голосов
2ответов
4598 просмотров

How to properly define properties in c++/cli in headers/body

I am trying to do property double Real; and then double Data::ComplexNumber::Real::get() { return _real; } But it is giving error. How do you go about declaring the methods in the header file and then actually implementing them? Do you use this approach in c++/cli, or you'll go the c#/v...

40
голосов
1ответов
15787 просмотров

How to use Nullable types in c++/cli?

I have the following code, which I thought would work: property Nullable&lt;double&gt; Angle { Nullable&lt;double&gt; get() { return nullptr; } } It doesn't. How can I do it? Does c++/CLI even support nullable types?

1
голосов
2ответов
1848 просмотров

How to inherit from ObservableCollection in Managed C++

When I try to create a class in managed C++ that inherits from ObservableCollection I get the error: error C2039: 'ObservableCollection' : is not a member of 'System::Collections::ObjectModel' Here's my code: using namespace System; using namespace System::Collections; using namespace System:...

2
голосов
3ответов
2304 просмотров

translate C++/CLI into C#

How I can translate small C++/CLI project to c#

4
голосов
5ответов
4102 просмотров

c++ sealed and interface

I noticed that there are sealed and interface keywords in C++. Is this just for CLR C++? If not, when were sealed and interface added to the C++ standard? Do they have the same meaning in C++ as they do in C#? If not, how do I get the equivalent in standard C++?

0
голосов
5ответов
516 просмотров

Unable to create an operator== for a generic type?

I've got a generic range class and I'm trying to add a comparison operator so I can test whether one range is equal to another. It fails to compile and I'm not sure how to fix the issues it's complaining about. Have I missed something obvious? Here's a snippet of the code: generic&lt;typename T&...

2
голосов
2ответов
2297 просмотров

System Arithmetic Exception: Delphi calling C# DLL via C++/CLI wrapper

I have a C# DLL that uses the XslCompiledTransform class for xml manipulations. I stole a C++/CLI wrapper for the C# DLL. When using Delphi 5 to implement the C++/CLI wrapper, I receive a System Arithmetic error. Here is the Delphi 5 declaration: procedure XsltMethod(XmlPath, XsltPath: PWideCha...

0
голосов
2ответов
349 просмотров

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 D...

6
голосов
4ответов
7056 просмотров

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 ...

2
голосов
1ответов
2025 просмотров

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() ...

2
голосов
3ответов
6023 просмотров

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?

2
голосов
1ответов
1359 просмотров

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; // &lt;My...

0
голосов
1ответов
305 просмотров

.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 fin...

10
голосов
1ответов
4888 просмотров

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#...

0
голосов
2ответов
253 просмотров

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

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 succes...

0
голосов
1ответов
526 просмотров

How to avoid .dll dependencies under .NET

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...

7
голосов
1ответов
2178 просмотров

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....

6
голосов
1ответов
1677 просмотров

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 h...

14
голосов
6ответов
5424 просмотров

Is C++/CLI faster than C#

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

0
голосов
1ответов
134 просмотров

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...