I am a C# developer (sorry) who has been thrown into some C++ (an Adobe toolbar). I basically want to open a window, get some input, and make a call to a WCF service. I can do this very easily and already have the code in a shared library in C#, so my preference is to simply make a call to a C# compiled DLL to show a form and let it do it's work...
From what I have read I can see this is possible and I have referenced the appropriate DLL, however I haven't got the foggiest how to call it.
I've tried namespace::class, namespace.class.method, using namespace namespace, and a myriad of other things but the namespace won't resolve.
How do you do this? Is it possible?
Alternatively I would be happy to write a form in the C++ environment, but when I add a form in Visual Studio it comes back with a load of "Object not set" errors and craps out.
It is not as complex as it looks like. You are merely required to exposed the classes as COM coclasses so C++ can consume them. That's it The very good article found by guestgulkan just show how to do it step by step.
Not sure what you mean, Nexius. A C# DLL doesn't export functions like regular C DLL's. The best way to interop with a managed DLL is through COM, like in the article posted by guestgulkan.
At least I have never seen anyone attempt something different.
Thanks for all the responses. I've tried to implement it as described in the support article guestgulkan, but the project I have, the one from Adobe, won't compile with common language runtime support.
My reading agrees with webJose, in that I need a managed DLL. I have two problems with that - I don't really understand the difference between managed and unmanaged, and I suspect that the Adobe project won't compile as managed...? Without knowing what "managed" is, I don't know.
I successfully compiled and imported the C# library as a com visible dll, but could find no way to use it. The final parts of the article say to enable CLR support, but I can't do that, so that may be why.
I also had a look at pinvoke, but that method seems like it is reliant on the CLR too?
Out of my depth really, with the C++ bits, but I will take a look at LoadLibrary as described in Nexius's posts...