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

Posted on 2008-10-01
Last Modified: 2013-12-14

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.
Question by:JohannRamon

Accepted Solution

jvulliet earned 500 total points
ID: 22658732

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:


Author Comment

ID: 22661097
Thanks jvulliet!

I will try it!


Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now