Explicit and Implicit Calls of DLLs

1. Implicit call

Header files and lib files are required when compiling the program, and DLL files are required when running, and the DLL files are always occupied during the running process.

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


Second, the explicit call

Nothing is needed at compile time. When you need to use the functions in the DLL, the API calls LoadLibrary() and FindProcAdress() are used.

Only one DLL file is needed, and the DLL is occupied only when it needs to be used, and it is released after use (FreeLibrary).

Which functions in the DLL can be queried through the Depends tool.


Note:

Classes or functions provided in the DLL for external use need to be decorated with __declspec(dllexport). Such as:

class __declspec(dllexport) Controller
{
    ...
};


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324692135&siteId=291194637