Jump to content
  • Advertisement

Archived

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

jtech

DLLs and passing data

This topic is 6072 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 it safe to return a function pointer from a DLL (the function body is in the DLL) and use that function pointer in a program that loaded the DLL? So, this is almost like exporting a function from a DLL and using GetProcAddress, except I''m passing the function pointer explicitly through another exported function.

Share this post


Link to post
Share on other sites
Advertisement
Sure why not.. just make sure you access your pointers correctly. The last time I read someone talking about GetProcAddress was in a windows assembly book i was reading a few years ago. Whew =)


This is a view of ideas at work

Share this post


Link to post
Share on other sites
It''s safe, until you call FreeLibrary() on the DLL. Once you call FreeLibrary() all bets are off. The system could unload the DLL at any point after that, and then your pointer would point into memory that you aren''t allowed to touch (or worse, the memory region could have been reused, and then really bad things can happen).



-Brannon

Share this post


Link to post
Share on other sites
Thanks, I had a feeling it was ok, but wasn''t sure.

The only reason why I want to do something like this is to
have a single point of entry into my DLL. All other functions
in the DLL can then simply be passed through a single exported
function.

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!