mixed-mode

What libraries do I need to link my mixed-mode application to?

I'm integrating .NET support into our C++ application. It's an old-school MFC application, with 1 extra file compiled with the "/clr" option that references a CWinFormsControl. I'm not allowed to remove the linker flag "/NODEFAULTLIB". (We have our own build management system, not Visual Studio's.) This means I have to specify all neces...

Dump CCWs and RCWs in a mixed managed/unmanaged process

I have a mixed managed/unmanaged environment (Visual Studio and ReSharper) and I suspect CCW or RCW leak. Is there any way to dump all currently allocated wrappers and identify their source/target? I have WinDbg, SOS & SOSEx, so I can see total number of RCWs and CCWs with !syncblk command. I just want to see objects, so I can call !gcro...

Mixed Mode Library and CRT Dependencies - HELP

Alright, after doing a ton of research and trying almost every managed CPP Redist I can find as well as trying to copy my DLLs locally to the executing directory of the app I cannot figure out what dependencies i'm missing for this mixed mode library. Basically I have a large C# application and I'm trying to use a mixed mode library I m...

How do I set a Data Breakpoint in mixed( C#/C++ ) debugging?

I launch my program in C#, which then calls some unmanaged C++. When I break on a line in the unmanaged C++, the 'New Data Breakpoint' menu item is grayed out. Is there anyway around this? ...

Creating a Mixed Mode C++ Bridge from C to C#?

I hope someone can help me with this, I'm mostly a C# developer so my C and C++ skills are bad. I have a native C dll that is a plugin of a larger application. I cross compile this dll for windows on linux using gcc. In the native dll when I create a D3DSurface I want to call a function in a Mixed Mode C++ dll and pass in the pointer ...

Using mixed DLLs from /clr:pure projects

I'm building a project along with a Dll. The Dll must support native code so I declared it as a /clr. My project was initialy also a /clr project and everything was fine. However I'd like to include some NUnit testing so I had to switch my main project from /clr to /clr:pure. Everything still compiles but any Dll call generates a runti...

Visual Studio: Garbled debug watch of std::string's ?

When I'm debugging C++ mixed (managed/unmanaged) projects in Visual Studio 2005, I often get weird data from the debug watches, like below : (btw, the variable i_processName is a const std::string & ) Note that the variable actually holds valid data - if i print it to stdout, the printed string is just fine, thanks for asking. The sim...

Help postmorten debugging of a mixed mode Win32 application

Here's the situation: Background I have a mixed mode .NET/Native application developed in Visual Studio 2008. What I mean by mixed mode is that the front end is written in C++ .NET which calls into a native C++ library. The native code does the bulk of the work in the app, including kicking off new threads as it requires. The .NET co...

Mixing different versions of libraries in code for Linux.

The program that I am working on is statically linked to a 3rdPartyLibrary.lib. We wanted to take advantage of a newer version of the same 3rdPartyLibrary, say 3rdPartyLibraryNewVersion.lib. So the decision is to include the 3rdPartyLibraryNewVersion.so as a dynamically linked library, to be included via a wrapper dynamic library calle...

Access Violation probem with unhandled managed Exceptions in managed C++ .NET application

This is actually a solved problem, but it's so esoteric I thought I'd share it for other users. Also perhaps others might suggest reasons? Anyway, I'm working on a "mixed mode" .NET application written in managed C++, but with heavy links into existing native libraries. The problem was, unhandled managed exceptions ended up as Win32 A...

Mixed mode MFC application not intializing correctly in VS2008

I have converted a mixed mode MFC application from VS2005 to VS2008. It is compiling OK but when starting the application I get an assert in afxwin1.inl because afxCurrentResourceHandle = NULL. This is before MyCWinApp::InitInstance is called. The call stack is mfc90d.dll->AfxWinInit (with HINSTANCE = NULL) myapp.exe!InternalDllMain my...

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 (private memory). Then leaks memory slowish, say a MB every hour when running under simulated...

Mixed language statically linking with gfortran and gcc

Hi, I have some code written in C and Fortran that I want to compile into a statically-linked executable. If I compile the code dynamically (using the -fno-underscoring option for gfortran), it all works fine. However, I want to link it into a .so file, statically linking most of the needed libraries, and then link dynamically to libkrb5...

Mixed Mode C++ DLL function call failure when app launched from network share. Called from unmanaged c application.

Mixed-mode DLL called from native C application fails to load: An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module. Additional information: Could not load file or assembly 'XXSharePoint, Version=0.0.0.0, Culture=neutral, PublicKeyToken=e0fbc95fd73fff47' or one of its dependencies. Failed to grant mini...

How to get a full stacktrace from a crashed mixed mode exe/dll ?

Hi ! I wrote an application in C++/CLR. It uses a native lib/dll. On rare occasions, it crashes insider this native dll. I then get a stacktrace, but only up to the managed part, the inside native part is left out. Is there a way to let it display the whole stacktrace? I made the following test: I added a line of code inside the native...

What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

While converting a project that used SlimDX, and therefore has unmanaged code, to .NET 4.0 I ran into the following error: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. Googling around gave me the solution, which is to a...

.NET mixed multi-file assembly

I need to create a .NET assembly composed of 2 modules: 1 internal (in the DLL) with native code and 1 external (in a .netmodule file). This would be easy to do, except for the native part. C#'s compiler can do this (this is what I want, but with native code): csc /t:library /out:foobar.dll foo.cs /out:bar.netmodule bar.cs -foobar.dll...

How to determine which C/C++ objects use most memory

Hi! I have a mixed mode application (managed and native) which has a high memory footprint. I already have found out that most of the memory is allocated by native code. I am not talking about a memory leak, but about a high memory consumption that occurs very early after the program starts and then is relatively stable. Are you aware ...

Native C Dll calling C++/CLI Mixed Mode Dll - Unhandled Exception

I have a Native C Dll that is dynamically loaded by a legacy application. The intent of this dll is to allow overriding of application behavior based on certain application events. I have a C# dll that contains functions that I call from the Native C dll through the mixed mode C++/CLI dll to enhance these application events. The appli...

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 C# dll via COM wrapped calls. However that solution is pretty heavy. It requires that t...