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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Service to Receive TCP Packets 4 117
Getfiles in 28 42
how to read json value 2 27
Embarcadero C++ Builder XE10.1 Berlin red arrow Indicator 2 12
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

948 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

19 Experts available now in Live!

Get 1:1 Help Now