Programing

DLL 파일이란 무엇이며 어떻게 작동합니까?

lottogame 2020. 5. 9. 09:05
반응형

DLL 파일이란 무엇이며 어떻게 작동합니까?


DLL 파일은 정확히 어떻게 작동합니까? 그것들이 끔찍한 것처럼 보이지만 나는 그들이 무엇인지, 어떻게 작동하는지 모르겠습니다.

그래서 그들과의 거래는 무엇입니까?


DLL이란 무엇입니까?

DLL (Dynamic Link Libraries)은 EXE와 유사하지만 직접 실행할 수는 없습니다. Linux / Unix의 .so 파일과 비슷합니다. 즉, DLL은 MS가 공유 라이브러리를 구현 한 것입니다.

DLL은 EXE와 매우 유사하여 파일 형식 자체가 동일합니다. EXE 및 DLL은 모두 PE (Portable Executable) 파일 형식을 기반으로합니다. DLL은 COM 구성 요소 및 .NET 라이브러리도 포함 할 수 있습니다.

DLL은 무엇을 포함합니까?

DLL에는 EXE 또는 다른 DLL이 사용하는 함수, 클래스, 변수, UI 및 리소스 (예 : 아이콘, 이미지, 파일 등)가 포함되어 있습니다.

도서관의 종류 :

거의 모든 운영 체제에는 두 가지 유형의 라이브러리가 있습니다. 정적 라이브러리 및 동적 라이브러리 Windows에서 파일 확장자는 정적 라이브러리 (.lib) 및 동적 라이브러리 (.dll)입니다. 주요 차이점은 정적 라이브러리가 컴파일 타임에 실행 파일에 연결되어 있다는 것입니다. 동적 링크 라이브러리는 런타임까지 링크되지 않습니다.

정적 및 동적 라이브러리에 대한 추가 정보 :

정적 라이브러리는 모듈 (EXE 또는 DLL) 내부에 직접 포함되므로 일반적으로 컴퓨터에는 정적 라이브러리가 표시되지 않습니다. 동적 라이브러리는 독립형 파일입니다.

DLL은 언제든지 변경 될 수 있으며 EXE가 DLL을 명시 적으로로드 할 때 런타임에만로드됩니다. 정적 라이브러리는 EXE 내에서 컴파일 된 후에는 변경할 수 없습니다. EXE 자체를 업데이트하지 않고 DLL을 개별적으로 업데이트 할 수 있습니다.

DLL로드 :

프로그램은 시작할 때, Win32 API LoadLibrary를 통해 또는 다른 DLL의 종속성 일 때 DLL을로드합니다. 프로그램은 GetProcAddress를 사용하여 함수를로드하거나 LoadResource를 사용하여 리소스를로드합니다.

더 읽을 거리 :

자세한 내용은 MSDN 또는 Wikipedia확인하십시오 . 또한이 답변의 출처.


DLL이란 무엇입니까?

DLL 파일은 이미지와 같은 실행 가능 코드와 리소스를 포함 할 수있는 이진 파일입니다. 응용 프로그램과 달리, 이러한 파일은 직접 실행할 수 없지만 필요할 때마다 (또는 시작하는 동안 한 번에)로드합니다.

그들이 중요합니까?

대부분의 응용 프로그램은 시작할 때 필요한 DLL 파일을로드합니다. 이들 중 하나라도 발견되지 않으면 시스템이 프로세스를 전혀 시작할 수 없습니다.

DLL 파일은 다른 DLL 파일을 요구할 수 있습니다

응용 프로그램에 DLL 파일이 필요한 것과 같은 방식으로 DLL 파일은 다른 DLL 파일 자체에 종속 될 수 있습니다. 종속성 체인에 이러한 DLL 파일 중 하나가 없으면 응용 프로그램이로드되지 않습니다. 이는 Dependency Walker 와 같은 종속성 워커 도구를 사용하여 쉽게 디버깅 됩니다.

시스템 폴더에 너무 많은 것들이 있습니다

대부분의 시스템 기능은 표준 형식의 공유 코드 / 자원이므로 DLL 파일 형식으로 사용자 프로그램에 노출됩니다. 각 기능은 서로 다른 DLL 파일로 별도로 유지되므로 필요한 DLL 파일 만로드되므로 시스템의 메모리 제한이 줄어 듭니다.

설치된 응용 프로그램은 DLL 파일도 사용합니다

DLL 파일은 또한 위에서 설명한 것처럼 물리적으로 기능을 분리하는 형태가됩니다. 좋은 응용 프로그램은 또한 절대적으로 필요할 때까지 DLL 파일을로드하려고하지 않으므로 메모리 요구 사항이 줄어 듭니다. 이로 인해 응용 프로그램에 많은 DLL 파일이 제공됩니다.

DLL 지옥

그러나 공유 DLL 파일과 파일이 필요한 프로그램간에 버전이 일치하지 않는 경우 시스템 업그레이드로 인해 종종 다른 프로그램이 중단되는 경우가 있습니다. 이 문제를 해결하기 위해 시스템 검사 점 및 DLL 캐시 등이 M $의 이니셔티브였습니다. .NET 플랫폼은이 문제에 전혀 직면하지 않을 수 있습니다.

DLL 파일 안에 무엇이 있는지 어떻게 알 수 있습니까?

DUMPBIN 또는 Dependency Walker 와 같은 외부 도구를 사용해야합니다.이 기능은 DLL 파일에 포함 된 공개적으로 보이는 기능 (내보내기라고 함)과 DLL 파일에서 필요한 DLL 파일 및이 DLL 파일에서 내보내는 기능을 보여줍니다. 의존합니다.

우리는 그것들을 어떻게 만들고 사용합니까?

공급 업체의 프로그래밍 설명서를 참조하십시오. C ++의 경우 MSDN의 LoadLibrary참조하십시오 .


라이브러리에서 찾은 일부 기능을 사용하는 실행 파일을 만들고 있다고 가정 해 봅시다.

사용하는 라이브러리가 static 인 경우 링커는 이러한 함수의 객체 코드를 라이브러리에서 직접 복사하여 실행 파일에 삽입합니다.

Now if this executable is run it has every thing it needs, so the executable loader just loads it into memory and runs it.

If the library is dynamic the linker will not insert object code but rather it will insert a stub which basically says this function is located in this DLL at this location.

Now if this executable is run, bits of the executable are missing (i.e the stubs) so the loader goes through the executable fixing up the missing stubs. Only after all the stubs have been resolved will the executable be allowed to run.

To see this in action delete or rename the DLL and watch how the loader will report a missing DLL error when you try to run the executable.

Hence the name Dynamic Link Library, parts of the linking process is being done dynamically at run time by the executable loader.

One a final note, if you don't link to the DLL then no stubs will be inserted by the linker, but Windows still provides the GetProcAddress API that allows you to load an execute the DLL function entry point long after the executable has started.


DLLs (dynamic link libraries) and SLs (shared libraries, equivalent under UNIX) are just libraries of executable code which can be dynamically linked into an executable at load time.

Static libraries are inserted into an executable at compile time and are fixed from that point. They increase the size of the executable and cannot be shared.

Dynamic libraries have the following advantages:

1/ They are loaded at run time rather than compile time so they can be updated independently of the executable (all those fancy windows and dialog boxes you see in Windows come from DLLs so the look-and-feel of your application can change without you having to rewrite it).

2/ Because they're independent, the code can be shared across multiple executables - this saves memory since, if you're running 100 apps with a single DLL, there may only be one copy of the DLL in memory.

Their main disadvantage is advantage #1 - having DLLs change independent your application may cause your application to stop working or start behaving in a bizarre manner. DLL versioning tend not to be managed very well under Windows and this leads to the quaintly-named "DLL Hell".


DLL files contain an Export Table which is a list of symbols which can be looked up by the calling program. The symbols are typically functions with the C calling convention (__stcall). The export table also contains the address of the function.

With this information, the calling program can then call the functions within the DLL even though it did not have access to the DLL at compile time.

Introducing Dynamic Link Libraries has some more information.


http://support.microsoft.com/kb/815065

A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Therefore, each program can use the functionality that is contained in this DLL to implement an Open dialog box. This helps promote code reuse and efficient memory usage.

By using a DLL, a program can be modularized into separate components. For example, an accounting program may be sold by module. Each module can be loaded into the main program at run time if that module is installed. Because the modules are separate, the load time of the program is faster, and a module is only loaded when that functionality is requested.

Additionally, updates are easier to apply to each module without affecting other parts of the program. For example, you may have a payroll program, and the tax rates change each year. When these changes are isolated to a DLL, you can apply an update without needing to build or install the whole program again.

http://en.wikipedia.org/wiki/Dynamic-link_library


DLL is a File Extension & Known As “dynamic link library” file format used for holding multiple codes and procedures for Windows programs. Software & Games runs on the bases of DLL Files; DLL files was created so that multiple applications could use their information at the same time.

IF you want to get more information about DLL Files or facing any error read the following post. https://www.bouncegeek.com/fix-dll-errors-windows-586985/


DLLs (Dynamic Link Libraries) contain resources used by one or more applications or services. They can contain classes, icons, strings, objects, interfaces, and pretty much anything a developer would need to store except a UI.

참고URL : https://stackoverflow.com/questions/124549/what-exactly-are-dll-files-and-how-do-they-work

반응형