Jump to content
  • Advertisement

Archived

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

krakrazor

Classes in DLL

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

How do i use a class in a runtime linked DLL? i wanna use this class: #ifdef CFSIO_EXPORTS #define CFSIO_API __declspec(dllexport) #else #define CFSIO_API __declspec(dllimport) #endif typedef int CFSERROR; class CFSIO_API CFSio { private: CFSERROR e_laste; // last error BOOL b_ready; // are we ready to use this handle? HANDLE h_file; // handle to file public: CFSio() { b_ready = FALSE }; //Make sure CFSio(LPCTSTR *filename); ~CFSio(); }

Share this post


Link to post
Share on other sites
Advertisement
The thing about using classes in a DLL is the issue of name mangling in C++. Different compilers can give different names to the same functions, so there''s really no *safe* way to do it. IIRC, if you don''t care about compatibility there is a way o do it in Visual C++ 6.0 (and probably other compilers), but otherwise the only way I have heard of is to return a pointer to the class. You have to declare C-style naming, wrapping things in an extern "C" block.. I haven''t done this in a while, so google > me.

Share this post


Link to post
Share on other sites
Also... if i make a loadtime DLL. will i be able to recompile the DLL, but not the EXE, and still have the EXE use the dll''s functions/classes?

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!