From: Jan Kotas Date: Sun, 10 Feb 2019 21:57:11 +0000 (-0800) Subject: Cleanup DLL exports (#22500) X-Git-Tag: accepted/tizen/unified/20190813.215958~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70cf6d489032f42c9f643d59825c994c0402a3f7;p=platform%2Fupstream%2Fcoreclr.git Cleanup DLL exports (#22500) --- diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp index f70a562..2a0f2eb 100644 --- a/src/debug/daccess/daccess.cpp +++ b/src/debug/daccess/daccess.cpp @@ -40,9 +40,10 @@ HINSTANCE g_thisModule; extern VOID STDMETHODCALLTYPE TLS_FreeMasterSlotIndex(); -DLLEXPORT -EXTERN_C BOOL WINAPI -DllMain(HANDLE instance, DWORD reason, LPVOID reserved) +#if FEATURE_PAL +DLLEXPORT // For Win32 PAL LoadLibrary emulation +#endif +EXTERN_C BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved) { static bool g_procInitialized = false; diff --git a/src/dlls/mscordbi/mscordbi.cpp b/src/dlls/mscordbi/mscordbi.cpp index cb50b9c..7173e73 100644 --- a/src/dlls/mscordbi/mscordbi.cpp +++ b/src/dlls/mscordbi/mscordbi.cpp @@ -18,8 +18,10 @@ extern BOOL WINAPI DbgDllMain(HINSTANCE hInstance, DWORD dwReason, // The main dll entry point for this module. This routine is called by the // OS when the dll gets loaded. Control is simply deferred to the main code. //***************************************************************************** -DLLEXPORT extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) +#ifdef FEATURE_PAL +DLLEXPORT // For Win32 PAL LoadLibrary emulation +#endif +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { // Defer to the main debugging code. return DbgDllMain(hInstance, dwReason, lpReserved); diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 7701035..45298c5 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -56,13 +56,16 @@ extern "C" IExecutionEngine* IEE(); extern "C" BOOL WINAPI _CRT_INIT(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved); #endif -extern "C" DLLEXPORT BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved); +extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved); // For the CoreClr, this is the real DLL entrypoint. We make ourselves the first entrypoint as // we need to capture coreclr's hInstance before the C runtime initializes. This function // will capture hInstance, let the C runtime initialize and then invoke the "classic" // DllMain that initializes everything else. -extern "C" DLLEXPORT BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) +#ifdef FEATURE_PAL +DLLEXPORT // For Win32 PAL LoadLibrary emulation +#endif +extern "C" BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) { STATIC_CONTRACT_NOTHROW; @@ -115,8 +118,10 @@ extern "C" DLLEXPORT BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, L return result; } -extern "C" -DLLEXPORT BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) +#ifdef FEATURE_PAL +DLLEXPORT // For Win32 PAL LoadLibrary emulation +#endif +extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) { STATIC_CONTRACT_NOTHROW; diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src index eaee90e..6ba08c9 100644 --- a/src/dlls/mscoree/mscorwks_unixexports.src +++ b/src/dlls/mscoree/mscorwks_unixexports.src @@ -20,7 +20,7 @@ CoreDllMain DllMain GetCLRRuntimeHost -; Win32 API and other PAL functions used by the mscorlib +; Win32 API and other PAL functions used by the System.Private.CoreLib CloseHandle CoTaskMemAlloc CoTaskMemRealloc @@ -31,29 +31,23 @@ CreateMutexW CreateMutexExW CreateSemaphoreW CreateSemaphoreExW -DuplicateHandle FormatMessageW FreeEnvironmentStringsW -GetACP GetCurrentProcessId GetCurrentThreadId GetEnvironmentStringsW GetEnvironmentVariableW -GetProcAddress GetStdHandle GetSystemInfo LocalAlloc LocalReAlloc LocalFree -MetaDataGetDispenser -MultiByteToWideChar OpenEventW OpenMutexW OpenSemaphoreW OutputDebugStringW QueryPerformanceCounter QueryPerformanceFrequency -RaiseException ReleaseMutex ReleaseSemaphore ResetEvent @@ -62,11 +56,5 @@ SetEvent SysAllocStringByteLen SysAllocStringLen SysFreeString -SysStringByteLen SysStringLen -VirtualAlloc -VirtualFree -GlobalMemoryStatusEx -VirtualQuery -WideCharToMultiByte WriteFile diff --git a/src/inc/cortpoolhdr.h b/src/inc/cortpoolhdr.h deleted file mode 100644 index 1db08b1..0000000 --- a/src/inc/cortpoolhdr.h +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//+------------------------------------------------------------------------ -// -// Declare DLL entry points for Cor API to threadpool -// -//------------------------------------------------------------------------- - -#ifdef EXPORTING_THREADPOOL_API -#define DllExportOrImport extern "C" __declspec (dllexport) -#else -#define DllExportOrImport extern "C" -#endif - -typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOL); - -DllExportOrImport BOOL __cdecl CorRegisterWaitForSingleObject(PHANDLE phNewWaitObject, - HANDLE hWaitObject, - WAITORTIMERCALLBACK Callback, - PVOID Context, - ULONG timeout, - BOOL executeOnlyOnce ); - - - -DllExportOrImport BOOL __cdecl CorUnregisterWait(HANDLE hWaitObject,HANDLE CompletionEvent); - -DllExportOrImport BOOL __cdecl CorQueueUserWorkItem(LPTHREAD_START_ROUTINE Function, - PVOID Context, - BOOL executeOnlyOnce ); - - -DllExportOrImport BOOL __cdecl CorCreateTimer(PHANDLE phNewTimer, - WAITORTIMERCALLBACK Callback, - PVOID Parameter, - DWORD DueTime, - DWORD Period); - -DllExportOrImport BOOL __cdecl CorChangeTimer(HANDLE Timer, - ULONG DueTime, - ULONG Period); - -DllExportOrImport BOOL __cdecl CorDeleteTimer(HANDLE Timer, - HANDLE CompletionEvent); - -DllExportOrImport VOID __cdecl CorBindIoCompletionCallback(HANDLE fileHandle, LPOVERLAPPED_COMPLETION_ROUTINE callback); - - -DllExportOrImport VOID __cdecl CorDoDelegateInvocation(int cookie); diff --git a/src/inc/crtwrap.h b/src/inc/crtwrap.h index c6f0525..aca2437 100644 --- a/src/inc/crtwrap.h +++ b/src/inc/crtwrap.h @@ -21,9 +21,10 @@ #include #include -#ifndef DLLEXPORT -// DLLEXPORT is defined to influence method visibility for some compilers. +#ifndef FEATURE_PAL +// CoreCLR.dll uses linker .def files to control the exported symbols. +// Define DLLEXPORT macro as empty on Windows. #define DLLEXPORT -#endif // !DLLEXPORT +#endif #endif // __CrtWrap_h__ diff --git a/src/jit/ee_il_dll.cpp b/src/jit/ee_il_dll.cpp index 31904cf..23f4e6b 100644 --- a/src/jit/ee_il_dll.cpp +++ b/src/jit/ee_il_dll.cpp @@ -159,7 +159,11 @@ void jitShutdown(bool processIsTerminating) #ifndef FEATURE_MERGE_JIT_AND_ENGINE -extern "C" DLLEXPORT BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved) +#ifdef FEATURE_PAL +DLLEXPORT // For Win32 PAL LoadLibrary emulation +#endif + extern "C" BOOL WINAPI + DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved) { if (dwReason == DLL_PROCESS_ATTACH) { diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index 3552dea..4b58797 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -4314,6 +4314,7 @@ See MSDN doc for memcpy --*/ EXTERN_C PALIMPORT +DLLEXPORT void *PAL_memcpy (void *dest, const void *src, size_t count); PALIMPORT void * __cdecl memcpy(void *, const void *, size_t) THROW_DECL; @@ -4600,13 +4601,14 @@ PALIMPORT char * __cdecl _strdup(const char *); PALIMPORT PAL_NORETURN void __cdecl exit(int); int __cdecl atexit(void (__cdecl *function)(void)); -PALIMPORT DLLEXPORT void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)(const void *, const void *)); -PALIMPORT void * __cdecl bsearch(const void *, const void *, size_t, size_t, -int (__cdecl *)(const void *, const void *)); - PALIMPORT char * __cdecl _fullpath(char *, const char *, size_t); #ifndef PAL_STDCPP_COMPAT + +PALIMPORT DLLEXPORT void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *)); +PALIMPORT DLLEXPORT void * __cdecl bsearch(const void *, const void *, size_t, size_t, + int(__cdecl *)(const void *, const void *)); + PALIMPORT time_t __cdecl time(time_t *); struct tm { @@ -4725,8 +4727,8 @@ PALIMPORT DLLEXPORT int * __cdecl PAL_errno(int caller); #define errno (*PAL_errno(PAL_get_caller)) #endif // PAL_STDCPP_COMPAT -PALIMPORT char * __cdecl getenv(const char *); -PALIMPORT int __cdecl _putenv(const char *); +PALIMPORT DLLEXPORT char * __cdecl getenv(const char *); +PALIMPORT DLLEXPORT int __cdecl _putenv(const char *); #define ERANGE 34 diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h index 78190fc..381eb46 100644 --- a/src/pal/inc/rt/palrt.h +++ b/src/pal/inc/rt/palrt.h @@ -372,9 +372,9 @@ typedef union _ULARGE_INTEGER { /******************* OLE, BSTR, VARIANT *************************/ -STDAPI_(LPVOID) CoTaskMemAlloc(SIZE_T cb); -STDAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, SIZE_T cb); -STDAPI_(void) CoTaskMemFree(LPVOID pv); +DLLEXPORT STDAPI_(LPVOID) CoTaskMemAlloc(SIZE_T cb); +DLLEXPORT STDAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, SIZE_T cb); +DLLEXPORT STDAPI_(void) CoTaskMemFree(LPVOID pv); typedef SHORT VARIANT_BOOL; #define VARIANT_TRUE ((VARIANT_BOOL)-1) @@ -386,11 +386,11 @@ typedef const OLECHAR* LPCOLESTR; typedef WCHAR *BSTR; -STDAPI_(BSTR) SysAllocString(const OLECHAR*); -STDAPI_(BSTR) SysAllocStringLen(const OLECHAR*, UINT); +DLLEXPORT STDAPI_(BSTR) SysAllocString(const OLECHAR*); +DLLEXPORT STDAPI_(BSTR) SysAllocStringLen(const OLECHAR*, UINT); DLLEXPORT STDAPI_(BSTR) SysAllocStringByteLen(const char *, UINT); -STDAPI_(void) SysFreeString(BSTR); -STDAPI_(UINT) SysStringLen(BSTR); +DLLEXPORT STDAPI_(void) SysFreeString(BSTR); +DLLEXPORT STDAPI_(UINT) SysStringLen(BSTR); DLLEXPORT STDAPI_(UINT) SysStringByteLen(BSTR); typedef double DATE; diff --git a/src/pal/src/cruntime/misc.cpp b/src/pal/src/cruntime/misc.cpp index 68427f5..ba274ae 100644 --- a/src/pal/src/cruntime/misc.cpp +++ b/src/pal/src/cruntime/misc.cpp @@ -243,7 +243,6 @@ PAL_qsort(void *base, size_t nmemb, size_t size, PERF_EXIT(qsort); } -DLLEXPORT PALIMPORT void * __cdecl PAL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, @@ -299,7 +298,6 @@ PAL_memcpy Overlapping buffer-safe version of memcpy. See MSDN doc for memcpy --*/ -DLLEXPORT EXTERN_C PALIMPORT void *PAL_memcpy (void *dest, const void *src, size_t count) diff --git a/src/pal/src/misc/environ.cpp b/src/pal/src/misc/environ.cpp index f73d7ec..9fc1346 100644 --- a/src/pal/src/misc/environ.cpp +++ b/src/pal/src/misc/environ.cpp @@ -1050,7 +1050,6 @@ See MSDN for more details. Note: The BSD implementation can cause memory leaks. See man pages for more details. --*/ -DLLEXPORT int __cdecl _putenv( const char * envstring ) @@ -1080,7 +1079,7 @@ Function : PAL_getenv See MSDN for more details. --*/ -DLLEXPORT char * __cdecl PAL_getenv(const char *varname) +char * __cdecl PAL_getenv(const char *varname) { char *retval; diff --git a/src/palrt/bstr.cpp b/src/palrt/bstr.cpp index 8b3cc36..ae22b15 100644 --- a/src/palrt/bstr.cpp +++ b/src/palrt/bstr.cpp @@ -71,7 +71,7 @@ inline HRESULT CbSysStringSize(ULONG cchSize, BOOL isByteLen, ULONG *result) * return value = BSTR, NULL if the allocation failed. * ***********************************************************************/ -DLLEXPORT STDAPI_(BSTR) SysAllocStringLen(const OLECHAR *psz, UINT len) +STDAPI_(BSTR) SysAllocStringLen(const OLECHAR *psz, UINT len) { BSTR bstr; @@ -168,7 +168,7 @@ SysAllocStringByteLen(const char FAR* psz, unsigned int len) * None * ***********************************************************************/ -DLLEXPORT STDAPI_(void) SysFreeString(BSTR bstr) +STDAPI_(void) SysFreeString(BSTR bstr) { if(bstr == NULL) return; @@ -187,7 +187,7 @@ DLLEXPORT STDAPI_(void) SysFreeString(BSTR bstr) * return value = unsigned int, length in characters. * ***********************************************************************/ -DLLEXPORT STDAPI_(unsigned int) +STDAPI_(unsigned int) SysStringLen(BSTR bstr) { if(bstr == NULL) diff --git a/src/palrt/comem.cpp b/src/palrt/comem.cpp index e0069d2..e44550d 100644 --- a/src/palrt/comem.cpp +++ b/src/palrt/comem.cpp @@ -11,17 +11,17 @@ #include "common.h" -DLLEXPORT STDAPI_(LPVOID) CoTaskMemAlloc(SIZE_T cb) +STDAPI_(LPVOID) CoTaskMemAlloc(SIZE_T cb) { return LocalAlloc(LMEM_FIXED, cb); } -DLLEXPORT STDAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, SIZE_T cb) +STDAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, SIZE_T cb) { return LocalReAlloc(pv, cb, LMEM_MOVEABLE); } -DLLEXPORT STDAPI_(void) CoTaskMemFree(LPVOID pv) +STDAPI_(void) CoTaskMemFree(LPVOID pv) { LocalFree(pv); } diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index 051a003..94b663b 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -846,7 +846,7 @@ public: pThis->Enter(); } - DLLEXPORT DEBUG_NOINLINE static void HolderLeave(PEFileListLock *pThis) + DEBUG_NOINLINE static void HolderLeave(PEFileListLock *pThis) { WRAPPER_NO_CONTRACT; ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT; diff --git a/src/vm/crst.h b/src/vm/crst.h index 33c0b84..a482552 100644 --- a/src/vm/crst.h +++ b/src/vm/crst.h @@ -189,7 +189,7 @@ private: c->Enter(); } - DLLEXPORT DEBUG_NOINLINE static void ReleaseLock(CrstBase *c) { + DEBUG_NOINLINE static void ReleaseLock(CrstBase *c) { WRAPPER_NO_CONTRACT; ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT; c->Leave(); @@ -202,7 +202,7 @@ private: // Argument: // input: c - the lock to be checked. // Note: Throws - DLLEXPORT static void AcquireLock(CrstBase * c) + static void AcquireLock(CrstBase * c) { SUPPORTS_DAC; if (c->GetEnterCount() != 0) @@ -211,7 +211,7 @@ private: } }; - DLLEXPORT static void ReleaseLock(CrstBase *c) + static void ReleaseLock(CrstBase *c) { SUPPORTS_DAC; }; diff --git a/src/vm/listlock.h b/src/vm/listlock.h index 25c7f49..d219055 100644 --- a/src/vm/listlock.h +++ b/src/vm/listlock.h @@ -196,14 +196,14 @@ public: // LockHolder holds the lock of the element, not the element itself - DLLEXPORT DEBUG_NOINLINE static void LockHolderEnter(Entry_t *pThis) + DEBUG_NOINLINE static void LockHolderEnter(Entry_t *pThis) { WRAPPER_NO_CONTRACT; ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT; pThis->Enter(); } - DLLEXPORT DEBUG_NOINLINE static void LockHolderLeave(Entry_t *pThis) + DEBUG_NOINLINE static void LockHolderLeave(Entry_t *pThis) { WRAPPER_NO_CONTRACT; ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;