communicating with dll's

This is a discussion on communicating with dll's within the Windows Programming forums, part of the Platform Specific Boards category; Hey guys,
Well I finished coding my dll, and I wanted to communicate with it, using my .exe... I know ...

communicating with dll's

Hey guys,

Well I finished coding my dll, and I wanted to communicate with it, using my .exe... I know between processess you can use pipes but I'm kinda lost right know, can you use pipes between Dll's and exe's? Or is there a better way of doing it?

no, you statically link to the LIB import library that is generated for the DLL, then you can just call the functions form your application directly adn teh LIB handles all the loading adn linking functionality. You can still update the DLL at any time without breaking the application, so long as you dont remove any of the functions it uses.

Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Is the code for the above DLL linking generated at compile time? So if you stat-link foo.lib and call foo(x), will the foo(x) call then be replaced with:

Code:

LoadLibrary(foo.dll)
GetProcAddress(foo(x))
FreeLibrary(foo.dll)

in the compiled object file? or does the LIB actually need to be present alongside the binary to perform the above steps on demand, whenever you run it?
If it is the former case, then why do people even bother using manual library loading for DLLs they create, when it could be done automatically for them just by using a static lib for that DLL?

Actually, linking against the static library means that the DLL will be added in the dependencies section of the executable, and thus the loader will load it. No explicit LoadLibrary call anywhere. No GetProcAddress either - the loader does that, too. And of course the FreeLibrary is resolved.

So not only is using the LIB more convenient, it typically is faster, too. Less indirection. But the LIB doesn't need to be present after you've compiled the whole thing.

So why do people manually load libraries? There are a few reasons.
1) They want to discover libraries at run time. This is typically done for plug-in systems.
2) They don't have a LIB. That happens, too.

Hey thanks, I think I understand now. I was confusing "dynamic-linking" with its subset "run-time linking". Although I've read the Wiki: DLL page many times before in the past, reading it again in light of what you said seemed to bring out that finer point that I seemed to have been overlooking before... you learn something new everytime.