Jump to content
  • Advertisement

Archived

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

Using __declspec(dllexport) to Export a Class

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

When I try to type this in one of my DLL headers: __declspec(dllexport) class FWMesh; I get the following warning: (dll folder location)\fwmesh.h(18) : warning C4091: ''__declspec(dllexport ) '' : ignored on left of ''class FWMesh'' when no variable is declared The library still compiles, but it seems that the class isn''t being exported, and I''m curious as to my bad syntax. This is probably a stupid mistake on my part, so please don''t ignore this thread... Thanks, Joshua Merchant

Share this post


Link to post
Share on other sites
Advertisement
__declspec(dllexport) has no effect on a class forward declaration. You need to apply it to the actual class definition.

Share this post


Link to post
Share on other sites
Hmm... I tried that before I posted, but it still gave the original error. That was actually my first attempt, after which I tried the forward definition (or whatever it''s called).

Share this post


Link to post
Share on other sites
Just looked it up on MSDN.

class __declspec(dllexport) CExampleExport : public CObject
{ ... class definition ... };

Did you put __declspec... before "class" in your code? That may be the problem.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!