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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:00:49+00:00 2026-06-16T18:00:49+00:00

I have C++ managed dll compiled with /clr that has some global functions. for

  • 0

I have C++ managed dll compiled with /clr that has some global functions.

for example

void Managed2UnManaged(DataStructures::AAA^ elem, DataStructures::CPP::AAA* copy_elem);    

when I try to use these functions in a C++ managed console application I get the following errors

error LNK2028: unresolved token (0A00048C) “void __clrcall Managed2UnManaged(class DataStructures::AAA ^,class DataStructures::CPP::AAA *)” (?Managed2UnManaged@@$$FYMXP$AAVAAA@DataStructures@NextIn@@PAV1CPP@23@@Z)

error LNK2019: unresolved external symbol “void __clrcall Managed2UnManaged(class DataStructures::AAA ^,class DataStructures::CPP::AAA *)” (?Managed2UnManaged@@$$FYMXP$AAVAAA@DataStructures@NextIn@@PAV1CPP@23@@Z)

I added to the console application a reference to the dll but it still gives the error.

I also tried adding __declspec(dllexport) but then I get

error C3395: ‘Managed2UnManaged’ : __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention

and if I specify __stdcall I get

error C4439: ‘Managed2UnManaged’ : function definition with a managed type in the signature must have a __clrcall calling convention

I am using VS2012.

the h file has

class XXX {
 public:
static void Managed2UnManaged(DataStructures::RegResult^ elem,     DataStructures::CPP::RegResult* copy_elem);
};

and the cpp file

 void XXX::Managed2UnManaged(DataStructures::RegResult^ elem, DataStructures::CPP::RegResult* copy_elem)
{

}

Problem Solved. the problem was that I also needed to declare the class public ref. this caused a different problem because that the native c++ types are private. so I had to use the make_public pragma.
Thanks all.

  • 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-16T18:00:50+00:00Added an answer on June 16, 2026 at 6:00 pm

    I think that the problem may be that the CLR doesn’t allow global functions.

    You must create a managed class and write your function as a static member function of that class, for that function to be exported.

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

Sidebar

Related Questions

I have a C++/CLI DLL that uses some managed code (written in C#). I
We have a c++ clr application that we have compiled into a dll. We
I have a situation in which a managed DLL calls some unmanaged DLL. I
Setup: I have a COM DLL that calls a method inside a managed C#
I have some C code that compiles to a DLL. From C#, I need
I have a solution that has a c++ dll project(MsgHook.cpp) with a function:- BOOL
I have a managed c++ dll with few managed classes that in turn call
I have a DLL compiled in Delphi 2007 and an example using it in
I have a managed class library (say mylib.dll) and a 3rd party managed app
I have successfully implemented interop beftween Win32 application and managed .Net dll as described

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.