c++ - Why COM DLLs exports should be marked "PRIVATE"? -
when building com dlls, why should exports dllgetclassobject
, dllcanunloadnow
, dllregisterserver
, dllunregisterserver
, etc. marked private
in exports
section of associated .def
file?
when build dll, linker automatically creates import library dll. contains list of exported functions. use import library in project uses dll.
specific com servers 4 exported functions found getprocaddress() , never have implicit dependency on com dll. create com objects cocreateinstance(), com plumbing takes care of locating dll , using getprocaddress() find dllgetclassobject() function. same story dllun/registerserver, found regsvr32.exe. , dllcanunloadnow, found com plumbing. therefore have no need import library.
using private ensures function doesn't exported import library. of them private, no import library @ all. nothing goes wrong if omit it, file linker you'll never use.
Comments
Post a Comment