Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling C# from C++

Tags:

c++

c#

visual-c++

I have been looking for a way to call a function written in a C# EXE project (VS 2008) from a C++ DLL project. I can include the C# code as part of the C++ project itself if that is possible. All that I have been able to find is calling the C# DLL from C++.

Ultimately I want to call C# code from VB6 but I ask the question this way because I don't believe the later way is possible without an intermediate step.

Thanks,

Ian

like image 214
Ian Reynolds Avatar asked Jul 17 '26 15:07

Ian Reynolds


1 Answers

Ultimately I want to call C# code from VB6 but I ask the question this way because I don't believe the later way is possible without an intermediate step.

You can register the C# classes to be visible to COM, and then call them directly from C++ or VB6.

For details, see the Example COM Class on MSDN, as well as Interoperability.

like image 50
Reed Copsey Avatar answered Jul 20 '26 05:07

Reed Copsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!