On Saturday 31 May 2025 20:01:11 LIU Hao wrote:
> 在 2025-5-31 00:43, Pali Rohár 写道:
> > Also these cleanups are important:
> > e0a38b59e92dc7fd568c983a20d71ecf71688aa9
> > 5a28a0560c350f9563e072eb55929b417c86bb53
> > 
> > We can teach gendef to "comment" DllRegisterServer, DllUnregisterServer,
> > DllCanUnloadNow, DllGetClassObject, DllEntryPoint and DllMain symbols.
> > 
> > Maybe there are even more symbols which should not be in the import
> > library.
> 
> Here's a list of symbols that are exported from Windows SDK libs. They need
> be either commented out or marked `PRIVATE`.
> 
> ```
> const PRIVATE_EXPORTS = [
>   'DllGetClassObject',
>   'DllGetClassObjectWOW',
>   'DllCanUnloadNow',
>   'DllRegisterServer',
>   'DllRegisterProxy',
>   'DllRegisterWindowClasses',
>   'DllUnregisterServer',
>   'DllUnregisterServerWeReallyMeanIt',  // ?? what does this damn thing do?
>   'DllUnregisterProxy',
>   '_DllEntryPoint',
>   '_DllMainCRTStartup',   // MSVC entry point
>   '_DllMainCRTStartupForGS',
>   '_DllMainCRTStartupForGS2',
>   'DllMain',
>   'DllMainCRTStartup',  // MinGW entry point
>   'DllGetVersion',
>   'DllDebugObjectRPCHook',
> ];
> ```
> 
> There are also symbols that are apparently not to be imported, such as
> `DllRegisterServerEx{A,W,}`, and all names that begin with `IID_` or
> `LIBID_`.

Some of them are documented as PRIVATE in MS linker documentation:
https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-warning-lnk4104
https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-warning-lnk4222

If both llvm and binutils supports PRIVATE keyword in def files then we
could mark them as PRIVATE. Otherwise put ';' at beginning of the line
as a comment.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to