How can i access a Visual C++ 2005 (.net ) Class Library DLL from within a Win32 console application?


I have a .net Class Library DLL that consumes a Web Service and i need to expose a method that can be called from an executable. I knew how to do this for another DLLS, where the DEF file or the IDL file shows the available methods but in this case i don't see neither of those files. I'm kind of new to this escenario.



I'm trying to follow the instructions here:
but can't make declspec work for managed code.
Who is Participating?
jvullietConnect With a Mentor Commented:

one possibility is to create a COM wrapper to your assembly (or just expose your assembly to COM if you have the source code).

Then it's fairly easy to do a call from unmanaged C++.

Example link:

or you can have your Win32 console application running in mixed mode, go to your project properties (General), the choose this option : Common Language Runtime Support (/clr)
You can now add a reference to the dll in your project.

Example link:

JohannRamonAuthor Commented:
Thanks jvulliet!

I will try it!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.