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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:23:04+00:00 2026-06-13T20:23:04+00:00

I have a dll, which accesses some classes outside of its project (I’m using

  • 0

I have a dll, which accesses some classes outside of its project (I’m using Visual Studio, so I have two projects). The thing is, in the header that the dll includes, which is outside of the dll’s project, there are only bodies of functions, like this:

x.h

class x
{
    void myFunc();
}

And in another cpp file, outside of the dll file:

#include "x.h"

x::myFunc()
{
    //.....
}

The dll is only getting the bodies of the functions, so when I compile, I get lots of unresolved external symbols (I’m quite sure that this is the issue, because I tested with another class fully built in a .h file, in another project, and no errors). So how can I solve this mystery?

  • 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-13T20:23:06+00:00Added an answer on June 13, 2026 at 8:23 pm

    It is normal for the import headers to only have function signatures; the actual function bodies are already compiled into the DLL binary and are resolved at link time by linking into the actual DLL.

    The first thing to try is to make sure you are actually linking to the said DLL. It isn’t enough to just include the header, you also need to link to the binary. So in your project configuration, you need to add a link to (for example) the .lib file that gets created along-side the DLL when the DLL is compiled (if in MSVC). This lib file lets the linker know how to connect the function signatures you included via the import header to the actual implementations contained in the DLL. If you’re on a different platform, the mechanics might be a little different, but the concepts will be similar.

    Edits:
    The next step is to make sure the binary is actually exporting the symbols you’re trying to link against. Make sure that all interface signatures are being exported via __declspec(dll_export) prefixes. Normally this is wrapped up in an IFDEF so that the header is declared export while the DLL is being compiled, but not when that header is included in a client project. Next, you could use dumpbin to check the mangled export names, and see if there is anything unexpected.

    Here’s a modified version of your example that illustrates this style of export (note, I haven’t tested if this compiles, apologies for any typos):

    #ifdef BUILDING_MYDLL
    #define MYDLL_API __declspec(dllexport)
    #else
    #define MYDLL_API __declspec(dllimport)
    #endif
    
    class MYDLL_API x
    {
        void myFunc();
    }
    

    You would then set your configuration to define BUILDING_MYDLL when compiling the dll, but not when compiling the executable. This way the functions are only marked export when compiling the library dll. Now you can mark your public API functions with MYDLL_API and they should get exported during build.

    Please note that dll_export, dll_import, and declspec are all very MSVC-specific constructs. Other compilers/runtimes handle symbol export in different ways.

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

Sidebar

Related Questions

I have a DLL which is written in native C++. The Visual Studio project
I have a DLL which starts up some basic Windows programs: using System; using
I have a DLL which exectues some code at its entry point, i.e. procedure
I have a DLL which contains unmanaged classes with methods. I'm trying to call
I have a DLL which I have included in my C# project. Let's call
Is it possible to put some classes into a DLL? I have several custom
I have written a class library in C# (mydll.dll) which accesses a third party
I have a DLL (Test.dll) which contains some Excel Addin, i don't know which
I have a DLL, which is designed in C++, included in a C# project
I have a dll which parses some web site. This component uses WebBrowser control

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.