Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Using DLL's

This topic is 6921 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

I was just wondering if there is a simple way to use a DLL with MSVC++ 5.0. I created a DLL with just 1 class, to test it out, but realized I didn''t know how to "link" (or whatever you do with them) it. Is there a command to suck out my class from the DLL? Something like bring_in_DLL(dll_name); The class is called TEST, and only has a constructor and destructor, and a protected "int x". -Sponge99

Share this post

Link to post
Share on other sites
In order to link a class into a DLL you need to declare it with __declspec(dllexport) when linking the DLL and __declspec(dllimport) when linking the executable. ex:
A sample header file:

#ifdef _DLL
#define DLLEXP __declspec(dllexport)
#define DLLEXP __declspec(dllimport)

class DLLEXP DllClass {

When compiling a DLL _DLL should be #defined and when compiling a executable _DLL should not be #defined. When linking the executable make sure that the DLL''s import library is linked as well.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!