Jump to content
  • Advertisement
Sign in to follow this  
Ahmet

dll loading

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

I have writed a program which use DLL's to make it has more modular architecture. Main idea to use dlls is make main program more robust to trivial program changes. I think writing trivial codes in dll. Main program calls multiple threads and every thread must call its own dll functions. I am not sure where to load library and where to call those functions. My programing mentality is like that: 1- Before my code is going to fork to threads I have loaded my dll with LoadLibrary function but on runtime it can be loaded multiple times.(LoadLibrary functions handles this situation and load only one handle) 2-Main program calls thread (up to 7) and every threads call its GetProcAddress function for certain task(It will personalize a smart card) Personalization function is big and works for 2-3 second. Every thread will work synchronous with card printer machines, and send-get tcp messages etc. Those are my questions : 1-) Is there a change for those Personalization functions's memories to conflict with other thread's memories? 2-) In runtime main program's threads will call GetProcAddress almost 40 times simultaneously, is it OK? Main program will close the threads after finishing personalization. Thats my questions for now, I have not deployed my code to live systems so I need those infos. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
This is my understanding, someone correct me if I'm wrong.

1. Every process which uses a dll has its own data, for globals and statics. As threads inside a process share the memory space, I believe they share the stuff in a dll aswell.

2. I haven't checked the docs (I think you have) if they explicitly mentions not to be thread safe. I believe GetProcAddress is thread safe though. If you're in doubt, write a unit test or put calls to that function behind a mutex.

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!