Questions tagged [mixed-mode]

A mixed-mode application is any application that combines native code (C++) with managed code (such as Visual Basic, Visual C#, or C++/CLI that runs on the common language runtime).

From MSDN:

A mixed-mode application is any application that combines native code (C++) with managed code (such as Visual Basic, Visual C#, or C++/CLI that runs on the common language runtime).

Mixed assemblies are capable of containing both unmanaged machine instructions and MSIL instructions. This allows them to call and be called by .NET components, while retaining compatibility with components that are entirely unmanaged. Using mixed assemblies, developers can author applications using a mixture of managed and unmanaged functionality.

249 questions
11
votes
1 answer

Performance of C++/CLI function pointers versus .NET delegates

For my C++/CLI project I just tried to measure the cost of C++/CLI function pointers versus .NET delegates. My expectation was, that C++/CLI function pointers are faster than .NET delegates. So my test separately counts the number of invocations of…
uebe
  • 488
  • 4
  • 11
10
votes
3 answers

Mixed-mode C++/CLI DLL throws exception on exit

I am having a problem with a C++/CLI mixed mode DLL that I created. It is throwing an exception when unloading as the .NET application that uses it exits. After DLL_PROCESS_DETACH is executed, the DLL does runtime clean-up using automatically…
Mark
  • 510
  • 1
  • 5
  • 18
10
votes
5 answers

Memory leak in Mixed Mode C++/CLR application

I'm having problems with a slow memory leak in my mixed mode C++/CLR .NET application. (It's C++ native static libraries linked into a VS2008 C++/CLR Windows Forms app with the "/clr" compiler setting) Typical behaviour: app starts using 30 MB…
John
  • 1,974
  • 2
  • 25
  • 32
9
votes
6 answers

How is marshalling performed when C++ code is called from C++/CLI?

According to this question it's possible to seamlessly combine managed and unmanaged code using C++/CLI. I don't quite get it - shouldn't there be marshalling between managed and unmanaged anyway? For example, I have InnerLibrary that is compiled as…
sharptooth
  • 167,383
  • 100
  • 513
  • 979
9
votes
4 answers

Mixed mode assembly is built against 'v2.0.50727' error

First of all, I've found the other posts on StackOverflow here, but it did not resolve my error. I have 3 different environments/domains with a build server in each location. My Dev and UAT environments build just fine, but the production version…
ganders
  • 7,285
  • 17
  • 66
  • 114
8
votes
1 answer

Linking unmanaged C++ DLL with managed C++ class library DLL

As in the question Creating simple c++.net wrapper. Step-by-step I am tring to use C++ classes in .NET but I am having problems building in Visual Studio (2008). I have an unmanaged class A (C++ compiled with /clr). I created a C++/clr class…
Roger Nelson
  • 1,882
  • 2
  • 15
  • 21
8
votes
2 answers

Will mixed mode assemblies (C++/CLI projects) work on .NET Core?

I have a code base that uses a C++/CLI project which exposes C++ classes to the CLR via thin wrapper classes. For example... C++ code in a C++ project class Foo { public Foo(bool wat) { /* do the things */ } }; C++/CLI code in a mixed-mode…
Nick Strupat
  • 4,928
  • 4
  • 44
  • 56
8
votes
2 answers

How to call a .NET DLL from a Win32 process?

What are the options when it comes to using a .NET DLL from a Win32 process? I need to basically use a C# DLL from a Win32 process. I have a possible solution right now that requires adding the C# DLL to the GAC (using RegAsm.exe), then calling the…
Zoran Simic
  • 10,293
  • 6
  • 33
  • 35
8
votes
1 answer

Does an ILSplit.exe exist, equivalent to ILMerge.exe, or how could this be made?

Does a utility for splitting a single .NET assembly into a subset of the full assembly exist? I.e. the "functional inverse" of ILMerge.exe? This tool, of course, would be difficult to produce if it had to track dependencies etc. between classes,…
nietras
  • 3,949
  • 1
  • 34
  • 38
7
votes
2 answers

How can I send a managed object to native function to use it?

How can I send a managed object to native function to use it? void managed_function() { Object^ obj = gcnew Object(); void* ptr = obj ??? // How to convert Managed object to void*? unmanaged_function(ptr); } // The parameter type should be…
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
7
votes
2 answers

C++/CLI Wrapping a Function that Returns a std::shared_ptr

I'm currently wrapping a C++ class with C++/CLI for .NET interoperability following the standard process of holding a native pointer in a managed class. In one instance, I have a native class that has a function like: std::shared_ptr
Seth
  • 8,213
  • 14
  • 71
  • 103
7
votes
1 answer

Mixed mode assembly not loading symbol for native C++ pdbs

I am working with mixed mode assemblies in C++/CLI. All managed mode assembled pdb's get loaded when successfully in mixed mode assembly, but native dll's and pdb's are not getting loaded even though the information of native pdb's is shown in the…
Usman
  • 2,742
  • 4
  • 44
  • 82
6
votes
3 answers

Resolve managed and native stack trace - which API to use?

This is continuation to my previous question - phase 2 so to say. First question was here: Fast capture stack trace on windows / 64-bit / mixed mode Now I have resolved a huge amount of stack traces and now wondering how to resolve symbol…
TarmoPikaro
  • 4,723
  • 2
  • 50
  • 62
6
votes
3 answers

My application is unmanaged. Where do I start introducing managed code?

My whole application (which is rather big, with a 20MB executable) is written in unmanaged C++. Because I can clearly see the advantages in using managed code, I want to start introducing managed code in my application, but where do I start? Can I…
Patrick
  • 23,217
  • 12
  • 67
  • 130
6
votes
3 answers

Mixed mode assembly is built against version '2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime

I'm using Visual Studio 2012 and the .Net Framework 4.5 I have 2 Solutions: 1) WPF Application 2) Class library (dll) The Class Library contains 3 buttons and a control that has to be inside a WindosFormsHost control since it was made for WinForms.…
1
2
3
16 17