.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

C++ to C# DLL

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :.NET Framework

I have LAGACY VB6 ActiveX DLL that exposes a function and it's called from a C++ applicatation. I want to re-write the VB6 ActiveX using C# and be able to make the same function call without having to change any C++ code; that is, I would like the C++ application to be able to use either the old DLL or the new one. I will also need to be able to debug the new DLL. So, I've created a new C# class library in the solution for the C++ application and named the class so it has the same name as the VB6 class. I've set the Build property for Register for COM interop, and in Assembly Information I set Make assembly COM-visible. Is there anything else I will need to do? Do I need to make sure that both the new DLL has the same GUID as the old one? What about the DLL Base Address setting?

In my first attempt at getting things to complile, the C++ app fails to complie complaining that it cannot import the tlb for the new ScComMMM DLL. The C++ app I'm dealing with contains the following code:

#import "ScComMMM.dll"

//pointer to _com_ptr_t object for ScComMMM.dll
ScComMMM::_clsScComMMMPtr* ppScComMMM = NULL;


View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend