I have a C++ DLL that needs to call a function (pass a value, return a value) in a C# class library.
Is my only option to give the C# DLL a COM interface and call it from C++ with IDispatch?
Is this the best method?
I have a C++ DLL that needs to call a function (pass a value, return a value) in a C# class library.
Is my only option to give the C# DLL a COM interface and call it from C++ with IDispatch?
Is this the best method?
Couple of options available for you here
This project Creates dll exports for static methods in classes. You could then call a C# static method from unmanaged code.
One approach that would work would be to call it though COM. You can use the Regasm tool to create the COM wrapper.
It's not the only option.
You could also compile your C++ DLL as a managed DLL.
You could host your C# DLL as a service and remote into it.