Click here to Skip to main content
15,886,760 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hello,

I have to integrate a C#.Net application in a C++ un managed MFC application considering it a separate module of the software. I have tried the method posted here. I followed all the steps but it could not help me because Visual Studio 2008 refused to built my project having output type as Class Library, .dll file is generated but I face the problem of .dll not registered when I try to import that in some C++ project. Basically I have a text box and some buttons in my C#.Net form and I want to merge this form into a c++ project along with all the events and methods I called in C#.Net application. Any help would be appreciated.
Posted
Updated 22-Jun-15 19:31pm
v2

1 solution

First of all, the idea to "integrate application", no matter what is it, is inherently bad. Libraries should be "integrated" (in fact, just used), not applications. This is not the purpose of most applications.

Also, I would not advise going this way, because this could be either difficult or awkward thing to do (doing just the opposite, using unmanaged code in .NET is much easier).

One approach is using COM components developed in .NET and used in unmanaged code. This is not hard to do, but it's awkward to use the obsolete technology, especially if you realize that the whole .NET technology was developed to get away from such things and introduce purely OOP technology.

Another method is rather exotic but is based on firm CLR standards: direct export of methods to unmanaged. Many would say it's impossible, but that's not true. The number of CodeProject articles demonstrated validity of such approach. Please see my past answers:
loading C# DLL in MFC[^],
How can I use a dll created in Visual Basic 2008 in Visual Basic 6.0[^],
Call Managed DLL written in C# from Unmanged Code VC++[^],
http://www.codeproject.com/Answers/236759/APIs-in-Net-Managed-or-UnManaged-Code#answer2[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900