C ++, Visual Studio 2012, LIB, DLL, Includes, Source and Linker

I'm trying to understand what exactly is and how they relate to each other (and, most importantly, how to install them).

From what I read, LIBs are libraries linked at compile time of my project, and DLLs are libraries linked at run time of my project.

So, for me to use LIB , I have to have the actual .LIB file somewhere on my computer, go to ProjectPropertiesVC ++ Directories and add the path to the file in the Library directories , after which I need to go to LinkerEnterFor additional dependencies, add the name .lib there, and finally, I need to enter #include in my code, right?

So, some questions:

  • When I finish and create a release of my program, will .exe work only if there is a .lib installed on their PC on the target platform? If so, what steps do I need to take to make sure .lib comes with .exe?

  • When I get the source of an open source project, if I add them (using Add existing item ... ) to my project, can I use them just using #include as if the files were mine, and that would be the same how to install .lib? Or do I need to install a .lib file and use these source files?

  • I have a project using OpenGL and I'm linked to glew32.lib , but I don't have the lib library or any new directory added to the VC ++ directories , so I think that means I had to install .lib in the system folder or somewhere where Visual Studio will not request another directory, can I worry about this when the project is released?

  • DLL - , DLL LIB ?

, , , , , , "" . , , , ...

+3
1
  • LIB EXE , LIB - , DLL - . EXE , DLL , DLL EXE . , .

  • , LIB. LIB . , VS.

  • , . , LIB , LIB EXE , .

  • DLL - , . EXE DLL , , LIB .

LIB, :

#pragma comment(lib, "glew32.lib")

, , LIB " ".

DLL : DLL DLL EXE : ,

#include <windows.h>

GetWindowsDirectory(windir, MAX_PATH);

, API GetWindowsDirectory EXE .

:

hinstDLL = LoadLibrary("kernel32.dll");
if (hinstDLL != NULL)
{
    func_GetWindir = (DLLPROC) GetProcAddress(hinstDLL, "GetWindowsDirectoryA");
...

, : , EXE , kernel32.dll kernel32.dll GetWindowsDirectory, EXE , . ( ) , API GetWindowsDirectoryA, . 0x00 func_GetWindir. , .

+3

All Articles