Calling C# dll from C++ 6.0 and GPF
-
This is a little difficult to explain. I created a dll in .NET using C# and I need to call this dll from a Visual C++ 6.0 application. I read numerous materials on setting the C# dll up with COM Interop and I think I have it working. Now for the difficult part: when I call the function to launch the UI in the C# dll, it comes up, then I do my thing and close it down. I then go through the functionality again and the dll is called w/ no problems, the form comes up, etc. When I close it down, I will get a GPF. In trying to trace the problem, it returns from my dll, then returns from my function in the 6.0 c++ application, and returns from another function. I cannot discover where the GPF is occurring. Here is a basic outline of my 6.0 c++ function: void functionname { // Initialize COM. HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IManageInterfacePtr pIInterface(__uuidof(ManagerInterface)); // Call the Add method. pIInterface->LaunchRSSDLL(string, string, string); pIInterface->Dispose(); <--this is from trying something with the C# dll pIInterface->Release(); // Uninitialize COM. CoUninitialize(); } I have put try/catch inside this function, around the call to this function, inside my C# DLL COM interface, and I still cannot find where the gpf is occurring. This is my first C# dll so be please be patient if I so kind of idiotic in describing this. Any ideas on what I may be missing? Any ideas on what I can look at?
-
This is a little difficult to explain. I created a dll in .NET using C# and I need to call this dll from a Visual C++ 6.0 application. I read numerous materials on setting the C# dll up with COM Interop and I think I have it working. Now for the difficult part: when I call the function to launch the UI in the C# dll, it comes up, then I do my thing and close it down. I then go through the functionality again and the dll is called w/ no problems, the form comes up, etc. When I close it down, I will get a GPF. In trying to trace the problem, it returns from my dll, then returns from my function in the 6.0 c++ application, and returns from another function. I cannot discover where the GPF is occurring. Here is a basic outline of my 6.0 c++ function: void functionname { // Initialize COM. HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IManageInterfacePtr pIInterface(__uuidof(ManagerInterface)); // Call the Add method. pIInterface->LaunchRSSDLL(string, string, string); pIInterface->Dispose(); <--this is from trying something with the C# dll pIInterface->Release(); // Uninitialize COM. CoUninitialize(); } I have put try/catch inside this function, around the call to this function, inside my C# DLL COM interface, and I still cannot find where the gpf is occurring. This is my first C# dll so be please be patient if I so kind of idiotic in describing this. Any ideas on what I may be missing? Any ideas on what I can look at?
I found my own answer in this article: http://www.dotnet247.com/247reference/msgs/35/178790.aspx I removed the line of code System.Windows.Forms.Application.EnableVisualStyles() and all is well.