Jump to content
  • Advertisement
Sign in to follow this  
Dark Star

Exporting object in DLLs

This topic is 5159 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 Forum, I know how to create DLLs but I was wondering how I would go about exporting objects and variables in a dll to the main applications. I know that when u have a function in a dll to be used in the main app, you write something like this before the function signature: __declspec(dllexport) void DoSomething() { //do something... } is this the same with the objects and variables u wanna export? If so, would I write this in the header file or cpp file or both? Thanks in advance DarkStar UK

Share this post


Link to post
Share on other sites
Advertisement
class __declspec(dllexport\import) TypeName
{
...
};

All static members should be declared export in the cpp files used to compile the DLL.

That is microsoft specific. I don't know about other windows compilers.

Share this post


Link to post
Share on other sites

Also make sure you put the __declaspec(dllexport) on the inner classes/structs. And the variables need a "extern __declaspec(dllexport)" in their declaration ... usually.

Quote:
Original post by Clash
All static members should be declared export in the cpp files used to compile the DLL.


I've never had to do declare static members with export...

Share this post


Link to post
Share on other sites
If you want the values of the static members available to the debugger, I've found that exporting them makes that happen. Not to mention, the Microsoft C++ compilers gives warnings when they are not exported.

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!