Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:35:36+00:00 2026-06-17T18:35:36+00:00

This question follows from my previous question: Create DLL from unmanaged C++ , but

  • 0

This question follows from my previous question: Create DLL from unmanaged C++, but you would not have to read it to understand this new question.

I now have a DLL that contains unmanaged C++ code consisting of a few functions, of which I only export one for outside use. Next, I need to use this DLL in a Managed C++ project (built with Common Language Runtime support). So far, I have added a reference to the existing unmanaged project’s header file by setting the Additional Include Directories in Visual Studio 2010.

If I now try to add a reference to the DLL file: MyManagedProject > Properties > Common Properties > Add New Reference > Browse > MyUnmanagedDLL.dll, I get an error Could not add a reference to file MyUnmanagedDLL.dll because it is neither a .NET assembly nor a registered ActiveX control. However, if I take the previously mentioned DLL and I copy it to the same folder as my Managed C++’s executable, everything works fine.

I am not sure if this is the correct way to do it, as it seems to be a hackish solution. Also, it means that I have to copy the DLL across every time I make a change to its source code.

To summarise my problem:

  1. I have created a DLL consisting of unmanaged C++ code, let’s call it MyUnmanagedDLL.dll. I have also created a header file for this DLL.
  2. I have a Managed C++ project (CLR), let’s call it MyManagedProject.vxproj
  3. How can I use MyUnmanagedDLL.dll in MyManagedProject.vxproj? Is there a correct way to reference it, or should I just copy it to the same directory as MyManagedProject.exe? (This works but I’m not sure if its good practise…)

Extra information: Windows 7, Visual Studio 2010 Ultimate, CMake 2.8.10.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:35:38+00:00Added an answer on June 17, 2026 at 6:35 pm

    You cannot add the unmanaged DLL as a reference to your managed C++ project. You can only do that with managed DLLs. What you do instead is link to the unmanaged DLL in the same way as you link to an unmanaged DLL in an unmanaged C++ project:

    • Use the header file for compilation.
    • Supply the unmanaged DLL’s .lib file to the linker, for example by adding it to the list of Additional Dependencies list in the linker configuration pages.
    • Put the DLL in the same directory as the executable, so that it can be located by the loader.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, this kind of follows on from my previous question . What I would
This question follows on from a previous question... How do I create the current
This question follows on from a previous question, that has raised a further issue.
This question follows on from a previous question. However stackoverflow presents me from commenting
This problem follows on from a previous question . When I run the following
This is a follow up from my previous question I have this code basically
this follows on from my last question which I thought was answered but for
From my previous question for selecting specific html text, I have gone through this
This follows my previous question about TFS 2010 and the possibility to create a
This follows on from my previous question about Moose structured types. I apologise for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.