difference between DLL wrapper and DLL [closed]

2019-06-27 18:13发布

问题:

I have no idea what is DLL wrapper. Could someone please explain me
1) what is DLL wrapper?
2) how it is different from DLL ?
3) how to use it?

Thanks and regards,

回答1:

When a program uses a DLL, it goes like this:

  • Application loads foo.dll
  • Application calls function in foo.dll
  • foo.dll executes function and returns value to application

With a wrapper DLL, this would happen:

  • Application loads foo.dll (not knowing or caring that foo.dll is in fact the wrapper, and the original DLL has been renamed to foo_original.dll)
  • foo.dll loads foo_original.dll
  • Application calls function in foo.dll
  • foo.dll forwards the call to foo_original.dll
  • foo_original.dll executes function and returns value to foo.dll
  • foo.dll returns value to application

This gives the DLL wrapper an opportunity to inspect/log all calls made by the application to the original DLL, as well as a chance to modify data being passed between the two.



回答2:

DLL wrapper calls another dll to provide required functionality. It may or may not provide its special API for simplicity or compatibility reasons. This is a tutorial that shows how to make a wrapper DLL. In this specific tutorial some of the classes from DirectX 9 are wrapped and used to render a teapot inside the Blitz3D window.



标签: c++ windows dll