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 7162775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:47:27+00:00 2026-05-28T13:47:27+00:00

I am using Visual Studio 2010 targeting .Net 4.0 I am working with an

  • 0

I am using Visual Studio 2010 targeting .Net 4.0

I am working with an unmanaged C++ dll using a managed C++ wrapper. I am using _declspec(dllexport) to export the unmanaged .dll below is the header file for the unmanaged dll:

class DllExport KeyManager
{
public:
KeyManager(const char *pszKeyFileName, int thisProduct);
~KeyManager();
...

I am then making a call to the unmanaged dll from the managed wrapper here:

#include "stdafx.h"
#include "KeyModCLR.h"
#using <mscorlib.dll>
#include <msclr/marshal.h>

using namespace System;
using namespace System::Runtime::InteropServices;
using namespace msclr::interop;


MCKeyManager::MCKeyManager(String ^fileName, int thisProduct)
{
    pszFileName = (char*)Marshal::StringToHGlobalAnsi(fileName).ToPointer();
    m_pC = new KeyManager(pszFileName, thisProduct);
}

This all works great when the project targets Win32, however when I change the target platform to x64 as described here I get the following error:

Error   17  error LNK2019: unresolved external symbol "public: __cdecl    

KeyManager::KeyManager  (char const *,int)" (??0KeyManager@@$$FQEAA@PEBDH@Z) referenced in
  function "public: __clrcall MCKeyManager::MCKeyManager(class System::String ^,int)" (?? 0MCKeyManager@@$$FQE$AAM@PE$AAVString@System@@H@Z)    

I am not terribly familiar with C++ as I did not write this code so I don’t know if I am missing something obvious. I have read that decoration of the imported functions are different for 64 bit and 32 bit but I am not sure how that necessarily affects me.

I have been looking for an answer all day and have come up short so any suggestions or advice would be greatly appreciated.

Thanks in advance

  • 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-05-28T13:47:28+00:00Added an answer on May 28, 2026 at 1:47 pm

    This type of error is probably attributable to the Configuration Manager setup. When you set up the x64 configuration, configuration manager will often set dependant .dll’s to be compiled as Win32 instead of x64. Open Configuration Manager for the solution, review the settings for each project. Verify that they will build an x64 configuration and that they are checked on to build.

    Another useful check is on calling convention. For instance, if one project uses _cdecl and another uses _stdcall, then calls between the projects will fail to link. The error message will show the calling convention that is being used by the calling project. You can use DUMPBIN / EXPORTS on the target .dll or .lib file to find out the calling convention that is being exported. (DUMPBIN is in the VC/bin folder).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
I am using the Visual Studio 2010 RC. Sometimes when I am working on
I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to
Using Visual Studio 2010 I believe it's working correctly, as in after any document
Using Visual Studio 2010, .NET 4 as a Console App. With a breakpoint on
I am using Visual Studio 2010 / ASP.net MVC 3 with the Razor View
I'm currently using Visual Studio 2010 and have created a 'ASP.NET MVC 3 Web
I'm using Visual Studio 2010 and I'm working on a windows application form. I'm
We have a ASP.Net web application running in Visual Studio 2010 that is targeting
I have a Windows service written in C# using Visual Studio 2010 and targeting

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.