C# App using Mixed Managed C++ crashes when access COM object through interop and unmanged code

R

ropo

I am using .NET 2.0

I have a C#.Net App, which uses a .NET Class Library, which accesses a
COM object through interop.
The C#.Net App also uses a mixed mode C++.Net Class library which uses
an unmanaged win32 DLL, which uses another unmanaged win32 DLL which
accesses the same COM object

The COM object is in another process.

Problem is When I attempt to access the COM object through both roots
the Application crashes without any messages. I can access the COM
object through either root but not both.


In the c# library I have something like:

LoggerClass _Logger = new LoggerClass() // interop wrapper for com
object

// this is called from the C#.Net app
public CSharp.Interface.Write(string strData)
{
_Logger.Write(strData);
}

In the C++ Win32 DLL I have something like:

void Write(LPCTSTR strData) // this is call from within another win32
DLL
{
// g_Logger is created in the first call using CoCreateInstance
g_Logger.Write(T2BSTR(strData));
}
 
R

ropo

Thankfully this was not a conceptual problem but due to my own
incompedence. I had a problem where I was overwriting memory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top