Jump to content
  • Advertisement

Archived

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

uNiQue0815

loading class methods from dll

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

is there a way to load a class (its methods) from dll ? i''m talking about doing this ''by hand''... with GetProcAddress... how do i have to export a class/its methods and how do i use GetProcAddress right ? or doesn''t that work at all ? how are class-methods loaded when using an import-library ? are they linked statically ? don''t think so, but i don''t know for sure... if they are linked dynamically, there has to be a way to do it manually, right ?

Share this post


Link to post
Share on other sites
Advertisement
One solution is to cast a pointer to the class object and call its member function. Another solution is to make the member function global.

Kuphryn

Share this post


Link to post
Share on other sites
quote:
Original post by uNiQue0815
is there a way to load a class (its methods) from dll ?


the easier solution is to make all functions virtual, create an interface class that is implemented by dll, and have dll export a function returning a pointer to an object of that class created by the dll (this is how COM works).

the other way is to import member functions by name with GetProcAddress, and then use pointers to member functions to call them. this works, but you''ll need to bother with mangled function names, so this method is far from something you want to deal with, considering it offers no speed benefits over the first one - you still need double jump.

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!