OK, I programmed a few DLLs using Linux years back. My memory (and my memory could be faulty), was that I had the program decide which dll to load based on user input. So I had two dlls, each with a string encrypt(string, string)function. The user was asked to specify the encryption method. If he selected AES, then aes.dll was loaded and the encrypt function inside aes.dll was called. If he specified Triple-DES, then tripledes.dll was loaded and its encrypt function was called. So the DLL was loaded in the MIDDLE of runtime, not the beginning, and the dll to load was unknown at the start of runtime. A string variable containing the DLL was filled in during runtime and code WRITTEN BY ME was executed in the middle of runtime, not the beginning.

Trying to recreate that in Visual Studio, I clicked through the new project options and created a HelloWorldDLL project with one function called HelloWorld, then I created a second project in that same solution, a console project that calls that pauses ten seconds, then calls the DLL's HelloWorld function.

Nowhere in the main function or in any other function that I wrote is HelloWorld.dll specified. Somehow the program knows which DLL to load, but not from any code that I see and definitely not in code that I wrote. I did do a few clicks in the Solution/Project properties to have HelloWorldConsole project depend on/reference the HelloWorldDLL project, so I imagine it's happening behind the scenes.

It's also clear that the dll is being loaded at the very start of main as opposed to after the ten second pause. Again, my memory of what I did in Linux might be wrong, but I would like to have some more control over which DLL is being loaded and when. Is there a way to do this with Visual Studio? Also, is there a way in Windows (i.e. Task Manager) to see what processes have loaded what dlls?

PS - I tried to add a "DLL" tag, but none came up for me and I saw no option to type in a tag that wasn't suggested (i.e. "DLL")

Edited by AssertNull: Added PS, corrected spelling

7 Months
Discussion Span
Last Post by AssertNull

Hmm, upon further research, I am seeing functions like "LoadLibrary" and "GetProcAddress" in other peoples' code, which looks closer to what I did in Linux (differernt function names, similar concept). I see nothing like that in my code. I'm wondering if that is because I used Visual Studio's New DLL Project temptlate and these folks did not.


OK, I've been researching a bit more and I think I need to study implicit vs. explicit DLL linking and load-time vs. runtime DLL linking. I am going to mork this as "Solved" for now even though it isn't. Will re-open if/when I learn those concepts and have a more pointed question.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.