Jump to content
  • Advertisement


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


Setting up this DLL o' mine

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

Lets see, I have a dll that i made. it compiles fine. I have all the functions int the DLL files declared as follows: void __declspec(dllexport) blahblahblah()... int __declspec(dllexport) more_blah(void** pointer).... etc. So, for me to use this DLL, ill have to create a header file (not included in the DLL), that looks like this: void __declspec(dllimport) blahblahblah()... int __declspec(dllimport) more_blah(void** pointer).... is this correct, the way i have it set up? Also, how would I create a data abstraction (such as a class) and be able to export it without having to actually define an instance of it to export (from within a DLL/Import Library)?

Share this post

Link to post
Share on other sites
Yep, that''s the way to do it for functions.

For classes, just put the _declspec(dllexport) macro inbetween class and class name in your headers, i.e:

class _declspec(dllexport) myClass

However, this would then require two sets of headers - one for internal use, and one for use in import. So, do something like this:

#define MYDLL_API _declspec(dllexport)
#define MYDLL_API _declspec(dllimport)

And then declare your classes thus:

class MYDLL_API myClass

And only #define MYDLL_EXPORT when you are building your dll.

Hope this helps,


Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Actually, I just have

#define DllExport __declspec(dllexport)
#define DllImport __declspec(dllimport)

But thx anyway. I can''t use __declspec(dllexport) on a constant initialized value tho, which kinda sucks, like:

const int __declspec(dllexport) ON = 1;

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.

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!