Often I hear "Stupid" questions regarding programming (and yes I make quite a few myself) 
That is, until I take a moment to remember "The only stupid question, is the one not NOT asked", so I will just ask and admit my stupidity
When it comes to loadlibrary, I see many schools of thought, and just wondered which is correct? or if just a matter of choice? (hoping I do not spark a debate, but had to ask)
In my mind (from what I understand from the docs, and the forums) Loadlibrary may or may not follow one or more of the following:
Scenario 1: - Local to the function you are currently using
That one pretty much ensures I got what I need, but if the 1st call to dll then isn't the dll mapped into my process until my process ends?
Scenario 2: - Local to the process
That one pretty much ensures I got what I need, but is it possible that what I read at the begginning did not change somewhere and at the end is now a new address?
Scenario 3: - Local to the process (sorta)
That one pretty much works, but since I load and free, are the addresses still good if I load once and free, only because still in the same process? Or am I asking for even more trouble with this one?
I get the "Scope" concept, but with the word "Scope", just what exactly is happening? is it the scope of the function that I look things up? or the scope that I mapped a dll into my process?, or does the scope get lost when I free?, or not really lost till my process ends?
must be confusing but then again now you know why I asked

That is, until I take a moment to remember "The only stupid question, is the one not NOT asked", so I will just ask and admit my stupidity

When it comes to loadlibrary, I see many schools of thought, and just wondered which is correct? or if just a matter of choice? (hoping I do not spark a debate, but had to ask)
In my mind (from what I understand from the docs, and the forums) Loadlibrary may or may not follow one or more of the following:
Scenario 1: - Local to the function you are currently using
- Loadlibrary
- Get the address to function you need
- Use the address
- Safety checks if the function exists.....(Or do I need this? or is it just my own check to be sure?)
- FreeLibrary
That one pretty much ensures I got what I need, but if the 1st call to dll then isn't the dll mapped into my process until my process ends?
Scenario 2: - Local to the process
- Loadlibrary
- Get each of the addresses to function(s) you need and store in global variables for use later
- Use the addresses
- Safety checks if the function exists.....(Or do I need this? or is it just my own check to be sure?)
- FreeLibrary at the end of my process
That one pretty much ensures I got what I need, but is it possible that what I read at the begginning did not change somewhere and at the end is now a new address?
Scenario 3: - Local to the process (sorta)
- Loadlibrary
- Get the addresses to function you need and store in global variables?
- FreeLibrary
- Use the addresses
- Safety checks if the function exists.....(Or do I need this? or is it just my own check to be sure?)
That one pretty much works, but since I load and free, are the addresses still good if I load once and free, only because still in the same process? Or am I asking for even more trouble with this one?
I get the "Scope" concept, but with the word "Scope", just what exactly is happening? is it the scope of the function that I look things up? or the scope that I mapped a dll into my process?, or does the scope get lost when I free?, or not really lost till my process ends?
must be confusing but then again now you know why I asked

Comment