Hi,
I have coded few methods in C++ language. These methods are to be used in C#.NET . I guess I need to convert the .CPP file(C++ code) into DLL and then import the methods in C#. Can any one give an idea how to convert .CPP file into DLL and then use that DLL in C#.
Thanks.
Loading
Pranav ThakurPosted Nov 10, 2009, 6:54 AM
Sam HobbsPosted Nov 3, 2009, 12:45 AM
Sam HobbsPosted Nov 3, 2009, 12:41 AM
Or you could create a COM object. That will require more time to learn but it will be more flexible.
Pranav ThakurPosted Nov 3, 2009, 12:06 AM
I followed the steps as you suggested but I could not add the created DLL into my project as reference.
I made a Win32 project and converted the exe(C++ code) into DLL.
I opened a new Visual Studio C#.NET project and tried to include the above DLL but I am getting error as :
A refernce to 'C:\application\test.dll' could not be added. No type libraries were found in the component.
Kirtan PatelPosted Nov 2, 2009, 8:26 AM
You need to make a Win32 Project, and in the dialog that comes up choose DLL.
Don't make a MFC DLL unless your specifically targeting MFC, they aren't a normal DLL
Check the radio button for Static Library.
Paste All Your Code Hit compile You will Get DLL File :)
if my answer helped you please check "Do you like this answer " :)
if any problem occurred feel free to tell me :)