Jump to content
  • Advertisement
Sign in to follow this  
rcag

importing DLL's in vc++

This topic is 4285 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a vc++ solution that creates a DLL and i want to use this DLL on another solution that i'm creating... How can i do this? I've included the .h with the prototypes of the DLL on the 2nd project and have copied the DLL into the project's directory but it gives me the following error Glove error LNK2019: unresolved external symbol "public: int __thiscall MyManager::OpenConnection(void)" (?OpenConnection@MyManager@@QAEHXZ) referenced in function "int __cdecl InitInstance(class CKContext *)" (?InitInstance@@YAHPAVCKContext@@@Z) can you help me?

Share this post


Link to post
Share on other sites
Advertisement
Building the DLL project should produce a .dll and a .lib in the output directory. The .lib is known as the "import library" or "import stub" or any number of similar terms.

The project that wishes to utilize the DLL must link with the import library. The import library contains the stubs that satisfy the linker (so it will no longer report missing defintions, et cetera).

Then, of course, the DLL must be distributed with the application at deployment time.

Share this post


Link to post
Share on other sites
hello again,

i have already included the lib directory into Additional Library Directories field, placed the lib name into additional dependencies field and placed the DLL into the project's directory but the same error keeps showing...


Share this post


Link to post
Share on other sites
The import library likely doesn't contain the symbol. Some options:

a) Make sure it exists in code (e.g., the header, source and call all match -- sometimes you might have two overloads of a function in a header, but forget to implement one, and that leads to this error).
b) Make sure it exists in the import library; use dumpbin. If it doesn't exist in the import library, you might have to muddle about with your symbol export settings (__declspec(dllexport) or an .exp file or other project options) to make sure the symbols in question are exported and thus appear in the import library.
c) Post the relevant code, there might be a syntax thing that is tripping you up; however this is unlikely. Releveant code would be the header and source containing the implementation, and the source where you try to call the function.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!