I know how to register dlls but I've never really been sure why I'm doing it or under what conditions a dll must be registered. Could somebody explain or point me to some documentation?
相关问题
- How to know full paths to DLL's from .csproj f
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- vs2017wpf项目引用dll的路径不正确的问题
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- Signing an F# Assembly (Strong name component)
- CosmosDB emulator can't start since port is al
When a DLL is registered, the
DllRegisterServer
method entry point in your DLL is invoked. Similarly,DllUnregisterServer
is invoked when a DLL is unregistered.As described in this MSDN article:
For COM DLLs, you will need to implement your own
DllRegisterServer
andDllUnregisterServer
entry point methods which do the registering/unregistering as appropriate. Example code forDllRegisterServer
can be found here.The end result of registering a DLL is that all of the CLSIDs for the components in the DLL are registered under
HKEY_CLASSES_ROOT\CLSID
. This allowsCoCreateInstance
to find the correct server when instantiating COM objects from another DLL or application.DllUnregisterServer
will do the reverse, and remove all of the CLSIDs from the registry that were put in there byDllRegisterServer
.More general information about
DllRegisterServer
can be found here.Simply see the source code of regsvr32.exe
What is most commonly referred to as DLL registering is when it implements a COM object. regsvr32 ensures that an instance of the object can be created. When e.g. VBScript uses New or CreateObject(), the registration ensures that COM knows what DLL to load in order to make a new instance, whether by name or CLSID.
See "the layman's explanation" for a (very) brief summary.