summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdeel Mujahid <adeelbm@outlook.com>2019-02-09 03:24:59 +0200
committerJan Vorlicek <janvorli@microsoft.com>2019-02-09 02:24:59 +0100
commit5bb7eb68035e98e356aba68115e28ed22d3d34aa (patch)
tree6a2ce545da5c8c32591910ffcb2fe86186894c22
parent8e79024b436f348ea9f96487a6d54067e750f596 (diff)
downloadcoreclr-5bb7eb68035e98e356aba68115e28ed22d3d34aa.tar.gz
coreclr-5bb7eb68035e98e356aba68115e28ed22d3d34aa.tar.bz2
coreclr-5bb7eb68035e98e356aba68115e28ed22d3d34aa.zip
Set visibility option to hidden (#21924)
-rw-r--r--CMakeLists.txt2
-rwxr-xr-xbuild.sh2
-rw-r--r--configurecompiler.cmake3
-rw-r--r--src/ToolBox/SOS/Strike/exts.h10
-rw-r--r--src/ToolBox/SOS/Strike/sos_stacktrace.h10
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp6
-rw-r--r--src/ToolBox/SOS/lldbplugin/sosplugin.cpp2
-rw-r--r--src/corefx/System.Globalization.Native/CMakeLists.txt3
-rw-r--r--src/debug/daccess/daccess.cpp1
-rw-r--r--src/debug/daccess/dacdbiimpl.h1
-rw-r--r--src/debug/daccess/nidump.cpp2
-rw-r--r--src/debug/di/cordb.cpp8
-rw-r--r--src/debug/di/process.cpp8
-rw-r--r--src/dlls/dbgshim/dbgshim.cpp20
-rw-r--r--src/dlls/dbgshim/dbgshim.h16
-rw-r--r--src/dlls/mscordbi/mscordbi.cpp2
-rw-r--r--src/dlls/mscoree/coreclr/CMakeLists.txt7
-rw-r--r--src/dlls/mscoree/mscoree.cpp14
-rw-r--r--src/dlls/mscoree/unixinterface.cpp5
-rw-r--r--src/gc/gcload.cpp2
-rw-r--r--src/inc/crtwrap.h9
-rw-r--r--src/jit/ee_il_dll.cpp8
-rw-r--r--src/nativeresources/rctocpp.awk2
-rw-r--r--src/pal/inc/pal.h92
-rw-r--r--src/pal/inc/pal_mstypes.h7
-rw-r--r--src/pal/inc/rt/guiddef.h2
-rw-r--r--src/pal/inc/rt/palrt.h4
-rw-r--r--src/pal/src/CMakeLists.txt16
-rw-r--r--src/pal/src/cruntime/misc.cpp4
-rw-r--r--src/pal/src/include/pal/module.h6
-rw-r--r--src/pal/src/locale/unicode_data.cpp6
-rw-r--r--src/pal/src/misc/environ.cpp3
-rw-r--r--src/pal/src/safecrt/mbusafecrt_internal.h8
-rw-r--r--src/pal/src/safecrt/memcpy_s.cpp2
-rw-r--r--src/pal/src/safecrt/sprintf_s.cpp5
-rw-r--r--src/pal/src/safecrt/sscanf_s.cpp2
-rw-r--r--src/pal/src/safecrt/swprintf.cpp4
-rw-r--r--src/pal/src/safecrt/vsprintf.cpp4
-rw-r--r--src/pal/src/safecrt/vswprint.cpp4
-rw-r--r--src/pal/src/safecrt/xtoa_s.cpp2
-rw-r--r--src/pal/src/safecrt/xtox_s.inl4
-rw-r--r--src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp8
-rw-r--r--src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp8
-rw-r--r--src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp2
-rw-r--r--src/palrt/bstr.cpp6
-rw-r--r--src/palrt/comem.cpp6
-rw-r--r--src/utilcode/ccomprc.cpp2
-rw-r--r--src/vm/appdomain.hpp4
-rw-r--r--src/vm/corhost.cpp1
-rw-r--r--src/vm/crst.h14
-rw-r--r--src/vm/listlock.h4
51 files changed, 217 insertions, 156 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9649e642d..5ac693b0be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,7 +37,7 @@ OPTION(CLR_CMAKE_ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
OPTION(CLR_CMAKE_WARNINGS_ARE_ERRORS "Warnings are errors" ON)
# Ensure that python is present
-find_program(PYTHON NAMES python3 python2 python)
+find_program(PYTHON NAMES python3 python2 python py)
if (PYTHON STREQUAL "PYTHON-NOTFOUND")
message(FATAL_ERROR "PYTHON not found: Please install Python 2.7.9 or later from https://www.python.org/downloads/")
endif()
diff --git a/build.sh b/build.sh
index 45ac18a70e..5793981dcc 100755
--- a/build.sh
+++ b/build.sh
@@ -7,7 +7,7 @@ export ghprbCommentBody=
# resolve python-version to use
if [ "$PYTHON" == "" ] ; then
- if ! PYTHON=$(command -v python3 || command -v python2 || command -v python)
+ if ! PYTHON=$(command -v python3 || command -v python2 || command -v python || command -v py)
then
echo "Unable to locate build-dependency python!" 1>&2
exit 1
diff --git a/configurecompiler.cmake b/configurecompiler.cmake
index 5afca2da71..d291595836 100644
--- a/configurecompiler.cmake
+++ b/configurecompiler.cmake
@@ -482,6 +482,9 @@ if (CLR_CMAKE_PLATFORM_UNIX)
# as x64 does. It has been causing issues in ARM (https://github.com/dotnet/coreclr/issues/4746)
add_compile_options(-fsigned-char)
+ # We mark the function which needs exporting with DLLEXPORT
+ add_compile_options(-fvisibility=hidden)
+
# Specify the minimum supported version of macOS
if(CLR_CMAKE_PLATFORM_DARWIN)
set(MACOS_VERSION_MIN_FLAGS "-mmacosx-version-min=10.12")
diff --git a/src/ToolBox/SOS/Strike/exts.h b/src/ToolBox/SOS/Strike/exts.h
index 36b5230c37..c66ba7ff64 100644
--- a/src/ToolBox/SOS/Strike/exts.h
+++ b/src/ToolBox/SOS/Strike/exts.h
@@ -182,8 +182,16 @@ inline BOOL IsInterrupt()
//
#undef DECLARE_API
+#ifndef DLLEXPORT
+#ifdef _MSC_VER
+#define DLLEXPORT __declspec(dllexport)
+#else
+#define DLLEXPORT __attribute__ ((visibility ("default")))
+#endif // _MSC_VER
+#endif // DLLEXPORT
+
#define DECLARE_API(extension) \
-CPPMOD HRESULT CALLBACK extension(PDEBUG_CLIENT client, PCSTR args)
+CPPMOD DLLEXPORT HRESULT CALLBACK extension(PDEBUG_CLIENT client, PCSTR args)
class __ExtensionCleanUp
{
diff --git a/src/ToolBox/SOS/Strike/sos_stacktrace.h b/src/ToolBox/SOS/Strike/sos_stacktrace.h
index 0af241ca3b..ed2b81b54f 100644
--- a/src/ToolBox/SOS/Strike/sos_stacktrace.h
+++ b/src/ToolBox/SOS/Strike/sos_stacktrace.h
@@ -95,7 +95,7 @@ struct StackTrace_SimpleContext
extern "C" {
#endif // __cplusplus
-HRESULT CALLBACK _EFN_StackTrace(
+DLLEXPORT HRESULT CALLBACK _EFN_StackTrace(
PDEBUG_CLIENT client,
__out_ecount(*puiTextLength) WCHAR wszTextOut[],
size_t *puiTextLength,
@@ -119,7 +119,7 @@ HRESULT CALLBACK _EFN_StackTrace(
// cbString - number of characters available in the string buffer.
//
// The output will be truncated of cbString is not long enough for the full stack trace.
-HRESULT CALLBACK _EFN_GetManagedExcepStack(
+DLLEXPORT HRESULT CALLBACK _EFN_GetManagedExcepStack(
PDEBUG_CLIENT client,
ULONG64 StackObjAddr,
__out_ecount(cbString) PSTR szStackString,
@@ -128,7 +128,7 @@ HRESULT CALLBACK _EFN_GetManagedExcepStack(
// _EFN_GetManagedExcepStackW - same as _EFN_GetManagedExcepStack, but returns
// the stack as a wide string.
-HRESULT CALLBACK _EFN_GetManagedExcepStackW(
+DLLEXPORT HRESULT CALLBACK _EFN_GetManagedExcepStackW(
PDEBUG_CLIENT client,
ULONG64 StackObjAddr,
__out_ecount(cchString) PWSTR wszStackString,
@@ -141,7 +141,7 @@ HRESULT CALLBACK _EFN_GetManagedExcepStackW(
// szName - a buffer to be filled with the full type name
// cbName - the number of characters available in the buffer
//
-HRESULT CALLBACK _EFN_GetManagedObjectName(
+DLLEXPORT HRESULT CALLBACK _EFN_GetManagedObjectName(
PDEBUG_CLIENT client,
ULONG64 objAddr,
__out_ecount(cbName) PSTR szName,
@@ -158,7 +158,7 @@ HRESULT CALLBACK _EFN_GetManagedObjectName(
// pOffset - the offset from objAddr to the field. This parameter can be NULL.
//
// At least one of pValue and pOffset must be non-NULL.
-HRESULT CALLBACK _EFN_GetManagedObjectFieldInfo(
+DLLEXPORT HRESULT CALLBACK _EFN_GetManagedObjectFieldInfo(
PDEBUG_CLIENT client,
ULONG64 objAddr,
__out_ecount (mdNameLen) PSTR szFieldName,
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index 2a24245ee0..82af32ede7 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -15149,7 +15149,7 @@ DECLARE_API(ExposeDML)
// According to kksharma the Windows debuggers always sign-extend
// arguments when calling externally, therefore StackObjAddr
// conforms to CLRDATA_ADDRESS contract.
-HRESULT CALLBACK
+HRESULT CALLBACK
_EFN_GetManagedExcepStack(
PDEBUG_CLIENT client,
ULONG64 StackObjAddr,
@@ -15196,7 +15196,7 @@ _EFN_GetManagedExcepStackW(
// According to kksharma the Windows debuggers always sign-extend
// arguments when calling externally, therefore objAddr
// conforms to CLRDATA_ADDRESS contract.
-HRESULT CALLBACK
+HRESULT CALLBACK
_EFN_GetManagedObjectName(
PDEBUG_CLIENT client,
ULONG64 objAddr,
@@ -15224,7 +15224,7 @@ _EFN_GetManagedObjectName(
// According to kksharma the Windows debuggers always sign-extend
// arguments when calling externally, therefore objAddr
// conforms to CLRDATA_ADDRESS contract.
-HRESULT CALLBACK
+HRESULT CALLBACK
_EFN_GetManagedObjectFieldInfo(
PDEBUG_CLIENT client,
ULONG64 objAddr,
diff --git a/src/ToolBox/SOS/lldbplugin/sosplugin.cpp b/src/ToolBox/SOS/lldbplugin/sosplugin.cpp
index 1aba481cc8..f575d0de91 100644
--- a/src/ToolBox/SOS/lldbplugin/sosplugin.cpp
+++ b/src/ToolBox/SOS/lldbplugin/sosplugin.cpp
@@ -5,7 +5,7 @@
#include "sosplugin.h"
namespace lldb {
- bool PluginInitialize (lldb::SBDebugger debugger);
+ DLLEXPORT bool PluginInitialize (lldb::SBDebugger debugger);
}
bool
diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt
index 026e5bb1e2..5e38c6bd12 100644
--- a/src/corefx/System.Globalization.Native/CMakeLists.txt
+++ b/src/corefx/System.Globalization.Native/CMakeLists.txt
@@ -7,9 +7,6 @@ add_definitions(-DBIT64=1)
set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
-# We mark the function which needs exporting with DLLEXPORT
-add_compile_options(-fvisibility=hidden)
-
find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp
index 95013760ca..f70a5623f4 100644
--- a/src/debug/daccess/daccess.cpp
+++ b/src/debug/daccess/daccess.cpp
@@ -40,6 +40,7 @@ HINSTANCE g_thisModule;
extern VOID STDMETHODCALLTYPE TLS_FreeMasterSlotIndex();
+DLLEXPORT
EXTERN_C BOOL WINAPI
DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
{
diff --git a/src/debug/daccess/dacdbiimpl.h b/src/debug/daccess/dacdbiimpl.h
index 403fa7f51f..cd1b7ad525 100644
--- a/src/debug/daccess/dacdbiimpl.h
+++ b/src/debug/daccess/dacdbiimpl.h
@@ -14,6 +14,7 @@
// Prototype for creation function
STDAPI
+DLLEXPORT
DacDbiInterfaceInstance(
ICorDebugDataTarget * pTarget,
CORDB_ADDRESS baseAddress,
diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp
index 9886aad4b1..e61c61d7a7 100644
--- a/src/debug/daccess/nidump.cpp
+++ b/src/debug/daccess/nidump.cpp
@@ -447,7 +447,7 @@ static OptionDependencies g_dependencies[] =
//
// This function gets the Dispenser interface given the CLSID and REFIID.
-STDAPI MetaDataGetDispenser(
+DLLEXPORT STDAPI MetaDataGetDispenser(
REFCLSID rclsid, // The class to desired.
REFIID riid, // Interface wanted on class factory.
LPVOID FAR * ppv) // Return interface pointer here.
diff --git a/src/debug/di/cordb.cpp b/src/debug/di/cordb.cpp
index 4febb5125a..ed4e4a8bda 100644
--- a/src/debug/di/cordb.cpp
+++ b/src/debug/di/cordb.cpp
@@ -130,7 +130,7 @@ STDAPI CreateCordbObject(int iDebuggerVersion, IUnknown ** ppCordb)
// Notes:
// It's inconsistent that this takes a (handle, pid) but hands back an ICorDebug instead of an ICorDebugProcess.
// Callers will need to call *ppCordb->DebugActiveProcess(pid).
-STDAPI CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, HMODULE hmodTargetCLR, IUnknown ** ppCordb)
+STDAPI DLLEXPORT CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, HMODULE hmodTargetCLR, IUnknown ** ppCordb)
{
if (ppCordb == NULL)
{
@@ -180,7 +180,7 @@ STDAPI CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPCWSTR lpApp
// Notes:
// It's inconsistent that this takes a (handle, pid) but hands back an ICorDebug instead of an ICorDebugProcess.
// Callers will need to call *ppCordb->DebugActiveProcess(pid).
-STDAPI CoreCLRCreateCordbObject(int iDebuggerVersion, DWORD pid, HMODULE hmodTargetCLR, IUnknown ** ppCordb)
+STDAPI DLLEXPORT CoreCLRCreateCordbObject(int iDebuggerVersion, DWORD pid, HMODULE hmodTargetCLR, IUnknown ** ppCordb)
{
return CoreCLRCreateCordbObjectEx(iDebuggerVersion, pid, NULL, hmodTargetCLR, ppCordb);
}
@@ -309,7 +309,7 @@ const GUID IID_IDebugRemoteCorDebug = {0x83C91210, 0xA34F, 0x427c, {0xB3, 0x5F,
// Called by COM to get a class factory for a given CLSID. If it is one we
// support, instantiate a class factory object and prepare for create instance.
//*****************************************************************************
-STDAPI DllGetClassObjectInternal( // Return code.
+STDAPI DLLEXPORT DllGetClassObjectInternal( // Return code.
REFCLSID rclsid, // The class to desired.
REFIID riid, // Interface wanted on class factory.
LPVOID FAR *ppv) // Return interface pointer here.
@@ -369,7 +369,7 @@ STDAPI DllGetClassObjectInternal( // Return code.
// (we went through the shim). CoreCLR doesn't have a shim and we go back to the COM model so we re-expose
// DllGetClassObject to make that work.
-STDAPI DllGetClassObject( // Return code.
+STDAPI DLLEXPORT DllGetClassObject( // Return code.
REFCLSID rclsid, // The class to desired.
REFIID riid, // Interface wanted on class factory.
LPVOID FAR *ppv) // Return interface pointer here.
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 2343122317..150d0e30da 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -61,7 +61,7 @@ extern RSDebuggingInfo * g_pRSDebuggingInfo;
// @dbgtodo attach-bit: need to determine fate of attach bit.
//
//---------------------------------------------------------------------------------------
-STDAPI OpenVirtualProcessImpl(
+STDAPI DLLEXPORT OpenVirtualProcessImpl(
ULONG64 clrInstanceId,
IUnknown * pDataTarget,
HMODULE hDacModule,
@@ -172,7 +172,7 @@ STDAPI OpenVirtualProcessImpl(
// Return Value:
// S_OK on success. Else failure
//---------------------------------------------------------------------------------------
-STDAPI OpenVirtualProcessImpl2(
+STDAPI DLLEXPORT OpenVirtualProcessImpl2(
ULONG64 clrInstanceId,
IUnknown * pDataTarget,
LPCWSTR pDacModulePath,
@@ -195,7 +195,7 @@ STDAPI OpenVirtualProcessImpl2(
// We'd like a beta1 shim/VS to still be able to open dumps using a CLR v4 Beta2+ mscordbi.dll,
// so we'll leave this in place (at least until after Beta2 is in wide use).
//---------------------------------------------------------------------------------------
-STDAPI OpenVirtualProcess2(
+STDAPI DLLEXPORT OpenVirtualProcess2(
ULONG64 clrInstanceId,
IUnknown * pDataTarget,
HMODULE hDacModule,
@@ -213,7 +213,7 @@ STDAPI OpenVirtualProcess2(
// Public OpenVirtualProcess method to get an ICorDebugProcess4 instance
// Used directly in CLR v4 pre Beta1 - can probably be safely removed now
//---------------------------------------------------------------------------------------
-STDAPI OpenVirtualProcess(
+STDAPI DLLEXPORT OpenVirtualProcess(
ULONG64 clrInstanceId,
IUnknown * pDataTarget,
REFIID riid,
diff --git a/src/dlls/dbgshim/dbgshim.cpp b/src/dlls/dbgshim/dbgshim.cpp
index 020dbdc564..c3f321a5ba 100644
--- a/src/dlls/dbgshim/dbgshim.cpp
+++ b/src/dlls/dbgshim/dbgshim.cpp
@@ -77,6 +77,7 @@ Notes:
// that can be supported cross-platform.
//
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CreateProcessForLaunch(
__in LPWSTR lpCommandLine,
@@ -137,6 +138,7 @@ CreateProcessForLaunch(
// ResumeProcess - to be used with the CreateProcessForLaunch resume handle
//
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
ResumeProcess(
__in HANDLE hResumeHandle)
@@ -155,6 +157,7 @@ ResumeProcess(
// CloseResumeHandle - to be used with the CreateProcessForLaunch resume handle
//
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CloseResumeHandle(
__in HANDLE hResumeHandle)
@@ -692,6 +695,7 @@ StartupHelperThread(LPVOID p)
// ppUnregisterToken -- pointer to put the UnregisterForRuntimeStartup token.
//
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
RegisterForRuntimeStartup(
__in DWORD dwProcessId,
@@ -732,6 +736,7 @@ RegisterForRuntimeStartup(
// ppUnregisterToken -- pointer to put the UnregisterForRuntimeStartup token.
//
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
RegisterForRuntimeStartupEx(
__in DWORD dwProcessId,
@@ -780,6 +785,7 @@ RegisterForRuntimeStartupEx(
//
// pUnregisterToken -- unregister token from RegisterForRuntimeStartup or NULL.
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
UnregisterForRuntimeStartup(
__in PVOID pUnregisterToken)
@@ -815,8 +821,9 @@ const int cchEventNameBufferSize = (sizeof(StartupNotifyEventNamePrefix) + sizeo
+ 8 // + hex process id DWORD
+ 10 // + decimal session id DWORD
+ 1; // '\' after session id
-
-HRESULT
+
+DLLEXPORT
+HRESULT
GetStartupNotificationEvent(
__in DWORD debuggeePID,
__out HANDLE* phStartupEvent)
@@ -1210,6 +1217,7 @@ EnumProcessModulesInternal(
// Notes:
// Callers use code:CloseCLREnumeration to free the returned arrays.
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
EnumerateCLRs(
DWORD debuggeePID,
@@ -1347,6 +1355,7 @@ EnumerateCLRs(
// dwArrayLength -- array length originally returned by EnumerateCLRs
//
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CloseCLREnumeration(
__in HANDLE* pHandleArray,
@@ -1473,6 +1482,7 @@ const WCHAR *c_versionStrFormat = W("%08x;%08x;%p");
// The version string is an opaque string that can only be passed back to other
// DbgShim APIs.
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CreateVersionStringFromModule(
__in DWORD pidDebuggee,
@@ -1707,6 +1717,7 @@ CheckDbiAndRuntimeVersion(
// the right debug pack is not installed.
// else Error. (*ppCordb will be null)
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersionEx(
__in int iDebuggerVersion,
@@ -1735,7 +1746,8 @@ CreateDebuggingInterfaceFromVersionEx(
// the right debug pack is not installed.
// else Error. (*ppCordb will be null)
//-----------------------------------------------------------------------------
-HRESULT
+DLLEXPORT
+HRESULT
CreateDebuggingInterfaceFromVersion2(
__in int iDebuggerVersion,
__in LPCWSTR szDebuggeeVersion,
@@ -1867,6 +1879,7 @@ Exit:
// the right debug pack is not installed.
// else Error. (*ppCordb will be null)
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion(
__in LPCWSTR szDebuggeeVersion,
@@ -1960,6 +1973,7 @@ GetContinueStartupEvent(
// Return:
// S_OK on success.
//-----------------------------------------------------------------------------
+DLLEXPORT
HRESULT
CLRCreateInstance(
REFCLSID clsid,
diff --git a/src/dlls/dbgshim/dbgshim.h b/src/dlls/dbgshim/dbgshim.h
index 018058bbe0..e3e7186da9 100644
--- a/src/dlls/dbgshim/dbgshim.h
+++ b/src/dlls/dbgshim/dbgshim.h
@@ -46,24 +46,24 @@ EXTERN_C HRESULT
UnregisterForRuntimeStartup(
__in PVOID pUnregisterToken);
-EXTERN_C HRESULT
+EXTERN_C HRESULT
GetStartupNotificationEvent(
__in DWORD debuggeePID,
__out HANDLE* phStartupEvent);
-EXTERN_C HRESULT
+EXTERN_C HRESULT
EnumerateCLRs(DWORD debuggeePID,
__out HANDLE** ppHandleArrayOut,
__out LPWSTR** ppStringArrayOut,
__out DWORD* pdwArrayLengthOut);
-EXTERN_C HRESULT
+EXTERN_C HRESULT
CloseCLREnumeration(
__in HANDLE* pHandleArray,
__in LPWSTR* pStringArray,
__in DWORD dwArrayLength);
-EXTERN_C HRESULT
+EXTERN_C HRESULT
CreateVersionStringFromModule(
__in DWORD pidDebuggee,
__in LPCWSTR szModuleName,
@@ -71,20 +71,22 @@ CreateVersionStringFromModule(
__in DWORD cchBuffer,
__out DWORD* pdwLength);
-EXTERN_C HRESULT
+EXTERN_C HRESULT
CreateDebuggingInterfaceFromVersionEx(
__in int iDebuggerVersion,
__in LPCWSTR szDebuggeeVersion,
__out IUnknown ** ppCordb);
-EXTERN_C HRESULT
+EXTERN_C
+DLLEXPORT
+HRESULT
CreateDebuggingInterfaceFromVersion2(
__in int iDebuggerVersion,
__in LPCWSTR szDebuggeeVersion,
__in LPCWSTR szApplicationGroupId,
__out IUnknown ** ppCordb);
-EXTERN_C HRESULT
+EXTERN_C HRESULT
CreateDebuggingInterfaceFromVersion(
__in LPCWSTR szDebuggeeVersion,
__out IUnknown ** ppCordb);
diff --git a/src/dlls/mscordbi/mscordbi.cpp b/src/dlls/mscordbi/mscordbi.cpp
index 94b4dc473d..cb50b9c67c 100644
--- a/src/dlls/mscordbi/mscordbi.cpp
+++ b/src/dlls/mscordbi/mscordbi.cpp
@@ -18,7 +18,7 @@ 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.
//*****************************************************************************
-extern "C"
+DLLEXPORT extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Defer to the main debugging code.
diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt
index 2619cba6cc..072965250a 100644
--- a/src/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/dlls/mscoree/coreclr/CMakeLists.txt
@@ -120,13 +120,18 @@ else()
list(APPEND CORECLR_LIBRARIES
${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available
coreclrpal
- tracepointprovider
${END_WHOLE_ARCHIVE}
mscorrc_debug
palrt
)
endif(WIN32)
+if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+ list(APPEND CORECLR_LIBRARIES
+ tracepointprovider
+ )
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
+
if(FEATURE_PERFTRACING)
list(APPEND CORECLR_LIBRARIES
eventpipe
diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp
index 40cc04f098..7701035fb4 100644
--- a/src/dlls/mscoree/mscoree.cpp
+++ b/src/dlls/mscoree/mscoree.cpp
@@ -56,13 +56,13 @@ extern "C" IExecutionEngine* IEE();
extern "C" BOOL WINAPI _CRT_INIT(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved);
#endif
-extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved);
+extern "C" DLLEXPORT 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" BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
+extern "C" DLLEXPORT BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
STATIC_CONTRACT_NOTHROW;
@@ -116,7 +116,7 @@ extern "C" BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpRe
}
extern "C"
-BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
+DLLEXPORT BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
STATIC_CONTRACT_NOTHROW;
@@ -221,7 +221,7 @@ HINSTANCE GetModuleInst()
// %%Function: MetaDataGetDispenser
// This function gets the Dispenser interface given the CLSID and REFIID.
// ---------------------------------------------------------------------------
-STDAPI MetaDataGetDispenser( // Return HRESULT
+DLLEXPORT STDAPI MetaDataGetDispenser( // Return HRESULT
REFCLSID rclsid, // The class to desired.
REFIID riid, // Interface wanted on class factory.
LPVOID FAR *ppv) // Return interface pointer here.
@@ -251,7 +251,7 @@ ErrExit:
// %%Function: GetMetaDataInternalInterface
// This function gets the IMDInternalImport given the metadata on memory.
// ---------------------------------------------------------------------------
-STDAPI GetMetaDataInternalInterface(
+DLLEXPORT STDAPI GetMetaDataInternalInterface(
LPVOID pData, // [IN] in memory metadata section
ULONG cbData, // [IN] size of the metadata section
DWORD flags, // [IN] MDInternal_OpenForRead or MDInternal_OpenForENC
@@ -280,7 +280,7 @@ STDAPI GetMetaDataInternalInterface(
// This function gets the internal scopeless interface given the public
// scopeless interface.
// ---------------------------------------------------------------------------
-STDAPI GetMetaDataInternalInterfaceFromPublic(
+DLLEXPORT STDAPI GetMetaDataInternalInterfaceFromPublic(
IUnknown *pv, // [IN] Given interface.
REFIID riid, // [IN] desired interface
void **ppv) // [OUT] returned interface
@@ -307,7 +307,7 @@ STDAPI GetMetaDataInternalInterfaceFromPublic(
// This function gets the public scopeless interface given the internal
// scopeless interface.
// ---------------------------------------------------------------------------
-STDAPI GetMetaDataPublicInterfaceFromInternal(
+DLLEXPORT STDAPI GetMetaDataPublicInterfaceFromInternal(
void *pv, // [IN] Given interface.
REFIID riid, // [IN] desired interface.
void **ppv) // [OUT] returned interface
diff --git a/src/dlls/mscoree/unixinterface.cpp b/src/dlls/mscoree/unixinterface.cpp
index cf9bbc5c72..0769ea464c 100644
--- a/src/dlls/mscoree/unixinterface.cpp
+++ b/src/dlls/mscoree/unixinterface.cpp
@@ -161,6 +161,7 @@ extern "C" int coreclr_create_delegate(void*, unsigned int, const char*, const c
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+DLLEXPORT
int coreclr_initialize(
const char* exePath,
const char* appDomainFriendlyName,
@@ -280,6 +281,7 @@ int coreclr_initialize(
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+DLLEXPORT
int coreclr_shutdown(
void* hostHandle,
unsigned int domainId)
@@ -310,6 +312,7 @@ int coreclr_shutdown(
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+DLLEXPORT
int coreclr_shutdown_2(
void* hostHandle,
unsigned int domainId,
@@ -344,6 +347,7 @@ int coreclr_shutdown_2(
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+DLLEXPORT
int coreclr_create_delegate(
void* hostHandle,
unsigned int domainId,
@@ -383,6 +387,7 @@ int coreclr_create_delegate(
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+DLLEXPORT
int coreclr_execute_assembly(
void* hostHandle,
unsigned int domainId,
diff --git a/src/gc/gcload.cpp b/src/gc/gcload.cpp
index 2d157c843e..f6977caace 100644
--- a/src/gc/gcload.cpp
+++ b/src/gc/gcload.cpp
@@ -13,11 +13,13 @@
#include "gcenv.h"
#include "gc.h"
+#ifndef DLLEXPORT
#ifdef _MSC_VER
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __attribute__ ((visibility ("default")))
#endif // _MSC_VER
+#endif // DLLEXPORT
#define GC_EXPORT extern "C" DLLEXPORT
diff --git a/src/inc/crtwrap.h b/src/inc/crtwrap.h
index 56f63cb422..c6f052507e 100644
--- a/src/inc/crtwrap.h
+++ b/src/inc/crtwrap.h
@@ -21,10 +21,9 @@
#include <wchar.h>
#include <stdio.h>
-#ifndef PUB
-// PUB is defined to influence method visibility for some compilers.
-#define PUB
-#endif // !PUB
+#ifndef DLLEXPORT
+// DLLEXPORT is defined to influence method visibility for some compilers.
+#define DLLEXPORT
+#endif // !DLLEXPORT
#endif // __CrtWrap_h__
-
diff --git a/src/jit/ee_il_dll.cpp b/src/jit/ee_il_dll.cpp
index 2dae497932..31904cfa44 100644
--- a/src/jit/ee_il_dll.cpp
+++ b/src/jit/ee_il_dll.cpp
@@ -54,7 +54,7 @@ JitOptions jitOpts = {
/*****************************************************************************/
-extern "C" void __stdcall jitStartup(ICorJitHost* jitHost)
+extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* jitHost)
{
if (g_jitInitialized)
{
@@ -159,7 +159,7 @@ void jitShutdown(bool processIsTerminating)
#ifndef FEATURE_MERGE_JIT_AND_ENGINE
-extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
+extern "C" DLLEXPORT BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
@@ -182,7 +182,7 @@ HINSTANCE GetModuleInst()
return (g_hInst);
}
-extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& cccallbacks)
+extern "C" DLLEXPORT void __stdcall sxsJitStartup(CoreClrCallbacks const& cccallbacks)
{
#ifndef SELF_NO_HOST
InitUtilcode(cccallbacks);
@@ -207,7 +207,7 @@ void* __cdecl operator new(size_t, const CILJitSingletonAllocator&)
ICorJitCompiler* g_realJitCompiler = nullptr;
-ICorJitCompiler* __stdcall getJit()
+DLLEXPORT ICorJitCompiler* __stdcall getJit()
{
if (ILJitter == nullptr)
{
diff --git a/src/nativeresources/rctocpp.awk b/src/nativeresources/rctocpp.awk
index e631021b35..6f8d597cf4 100644
--- a/src/nativeresources/rctocpp.awk
+++ b/src/nativeresources/rctocpp.awk
@@ -78,7 +78,7 @@ function writefooter(arrayName, tableName)
print "};";
print "";
- print "const NativeStringResourceTable " tableName " = {";
+ print "const NativeStringResourceTable " tableName " __attribute__((visibility(\"default\"))) = {";
print numEntries ",";
print arrayName "};";
}
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 67e39ae44f..3552dea565 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -208,8 +208,6 @@ typedef __builtin_va_list va_list;
#define VOID void
-#define PUB __attribute__((visibility("default")))
-
#else // __GNUC__
typedef char * va_list;
@@ -359,7 +357,7 @@ typedef long time_t;
PAL_INITIALIZE_ENSURE_STACK_SIZE | \
PAL_INITIALIZE_REGISTER_SIGNALS)
-typedef DWORD (PALAPI *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
+typedef DWORD (PALAPI_NOEXPORT *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
/******************* PAL-Specific Entrypoints *****************************/
@@ -1577,7 +1575,7 @@ PALAPI
ResumeThread(
IN HANDLE hThread);
-typedef VOID (PALAPI *PAPCFUNC)(ULONG_PTR dwParam);
+typedef VOID (PALAPI_NOEXPORT *PAPCFUNC)(ULONG_PTR dwParam);
PALIMPORT
DWORD
@@ -2578,7 +2576,7 @@ OpenFileMappingW(
#define OpenFileMapping OpenFileMappingA
#endif
-typedef INT_PTR (PALAPI *FARPROC)();
+typedef INT_PTR (PALAPI_NOEXPORT *FARPROC)();
PALIMPORT
LPVOID
@@ -2679,7 +2677,7 @@ Return value:
TRUE - success
FALSE - failure (incorrect ptr, etc.)
--*/
-BOOL
+BOOL
PALAPI
PAL_LOADUnloadPEFile(void * ptr);
@@ -2746,7 +2744,7 @@ GetModuleFileNameExW(
#define GetModuleFileNameEx GetModuleFileNameExW
#endif
-// Get base address of the module containing a given symbol
+// Get base address of the module containing a given symbol
PALAPI
LPCVOID
PAL_GetSymbolModuleBase(void *symbol);
@@ -2802,7 +2800,7 @@ typedef struct _MEMORYSTATUSEX {
DWORDLONG ullAvailExtendedVirtual;
} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
-PALIMPORT
+PALIMPORT
BOOL
PALAPI
GlobalMemoryStatusEx(
@@ -3268,7 +3266,7 @@ PAL_nanosleep(
#ifndef FEATURE_PAL_SXS
-typedef LONG (PALAPI *PTOP_LEVEL_EXCEPTION_FILTER)(
+typedef LONG (PALAPI_NOEXPORT *PTOP_LEVEL_EXCEPTION_FILTER)(
struct _EXCEPTION_POINTERS *ExceptionInfo);
typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
@@ -3280,7 +3278,7 @@ SetUnhandledExceptionFilter(
#else // FEATURE_PAL_SXS
-typedef EXCEPTION_DISPOSITION (PALAPI *PVECTORED_EXCEPTION_HANDLER)(
+typedef EXCEPTION_DISPOSITION (PALAPI_NOEXPORT *PVECTORED_EXCEPTION_HANDLER)(
struct _EXCEPTION_POINTERS *ExceptionPointers);
#endif // FEATURE_PAL_SXS
@@ -4370,62 +4368,62 @@ PALIMPORT int __cdecl toupper(int);
#define _TRUNCATE ((size_t)-1)
#endif
-PALIMPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t) THROW_DECL;
+PALIMPORT DLLEXPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t) THROW_DECL;
PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
PALIMPORT char * __cdecl _strlwr(char *);
-PALIMPORT int __cdecl _stricmp(const char *, const char *);
-PALIMPORT int __cdecl vsprintf_s(char *, size_t, const char *, va_list);
+PALIMPORT DLLEXPORT int __cdecl _stricmp(const char *, const char *);
+PALIMPORT DLLEXPORT int __cdecl vsprintf_s(char *, size_t, const char *, va_list);
PALIMPORT char * __cdecl _gcvt_s(char *, int, double, int);
PALIMPORT int __cdecl __iscsym(int);
PALIMPORT unsigned char * __cdecl _mbsinc(const unsigned char *);
PALIMPORT unsigned char * __cdecl _mbsninc(const unsigned char *, size_t);
PALIMPORT unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned char *);
-PALIMPORT int __cdecl _wcsicmp(const WCHAR *, const WCHAR*);
+PALIMPORT DLLEXPORT int __cdecl _wcsicmp(const WCHAR *, const WCHAR*);
PALIMPORT int __cdecl _wcsnicmp(const WCHAR *, const WCHAR *, size_t);
PALIMPORT int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
-PALIMPORT int __cdecl _vsnprintf_s(char *, size_t, size_t, const char *, va_list);
-PALIMPORT int __cdecl _vsnwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, va_list);
-PALIMPORT int __cdecl _snwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, ...);
-PALIMPORT int __cdecl _snprintf_s(char *, size_t, size_t, const char *, ...);
-PALIMPORT int __cdecl sprintf_s(char *, size_t, const char *, ... );
-PALIMPORT int __cdecl swprintf_s(WCHAR *, size_t, const WCHAR *, ... );
+PALIMPORT DLLEXPORT int __cdecl _vsnprintf_s(char *, size_t, size_t, const char *, va_list);
+PALIMPORT DLLEXPORT int __cdecl _vsnwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, va_list);
+PALIMPORT DLLEXPORT int __cdecl _snwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, ...);
+PALIMPORT DLLEXPORT int __cdecl _snprintf_s(char *, size_t, size_t, const char *, ...);
+PALIMPORT DLLEXPORT int __cdecl sprintf_s(char *, size_t, const char *, ... );
+PALIMPORT DLLEXPORT int __cdecl swprintf_s(WCHAR *, size_t, const WCHAR *, ... );
PALIMPORT int __cdecl _snwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, ...);
PALIMPORT int __cdecl vswprintf_s( WCHAR *, size_t, const WCHAR *, va_list);
-PALIMPORT int __cdecl sscanf_s(const char *, const char *, ...);
-PALIMPORT errno_t __cdecl _itow_s(int, WCHAR *, size_t, int);
+PALIMPORT DLLEXPORT int __cdecl sscanf_s(const char *, const char *, ...);
+PALIMPORT DLLEXPORT errno_t __cdecl _itow_s(int, WCHAR *, size_t, int);
-PALIMPORT size_t __cdecl PAL_wcslen(const WCHAR *);
-PALIMPORT int __cdecl PAL_wcscmp(const WCHAR*, const WCHAR*);
-PALIMPORT int __cdecl PAL_wcsncmp(const WCHAR *, const WCHAR *, size_t);
-PALIMPORT WCHAR * __cdecl PAL_wcscat(WCHAR *, const WCHAR *);
+PALIMPORT DLLEXPORT size_t __cdecl PAL_wcslen(const WCHAR *);
+PALIMPORT DLLEXPORT int __cdecl PAL_wcscmp(const WCHAR*, const WCHAR*);
+PALIMPORT DLLEXPORT int __cdecl PAL_wcsncmp(const WCHAR *, const WCHAR *, size_t);
+PALIMPORT DLLEXPORT WCHAR * __cdecl PAL_wcscat(WCHAR *, const WCHAR *);
PALIMPORT WCHAR * __cdecl PAL_wcsncat(WCHAR *, const WCHAR *, size_t);
PALIMPORT WCHAR * __cdecl PAL_wcscpy(WCHAR *, const WCHAR *);
PALIMPORT WCHAR * __cdecl PAL_wcsncpy(WCHAR *, const WCHAR *, size_t);
-PALIMPORT const WCHAR * __cdecl PAL_wcschr(const WCHAR *, WCHAR);
-PALIMPORT const WCHAR * __cdecl PAL_wcsrchr(const WCHAR *, WCHAR);
+PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcschr(const WCHAR *, WCHAR);
+PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcsrchr(const WCHAR *, WCHAR);
PALIMPORT WCHAR _WConst_return * __cdecl PAL_wcspbrk(const WCHAR *, const WCHAR *);
-PALIMPORT WCHAR _WConst_return * __cdecl PAL_wcsstr(const WCHAR *, const WCHAR *);
+PALIMPORT DLLEXPORT WCHAR _WConst_return * __cdecl PAL_wcsstr(const WCHAR *, const WCHAR *);
PALIMPORT WCHAR * __cdecl PAL_wcstok(WCHAR *, const WCHAR *);
-PALIMPORT size_t __cdecl PAL_wcscspn(const WCHAR *, const WCHAR *);
+PALIMPORT DLLEXPORT size_t __cdecl PAL_wcscspn(const WCHAR *, const WCHAR *);
PALIMPORT int __cdecl PAL_swprintf(WCHAR *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vswprintf(WCHAR *, const WCHAR *, va_list);
PALIMPORT int __cdecl PAL_swscanf(const WCHAR *, const WCHAR *, ...);
PALIMPORT LONG __cdecl PAL_wcstol(const WCHAR *, WCHAR **, int);
-PALIMPORT ULONG __cdecl PAL_wcstoul(const WCHAR *, WCHAR **, int);
+PALIMPORT DLLEXPORT ULONG __cdecl PAL_wcstoul(const WCHAR *, WCHAR **, int);
PALIMPORT size_t __cdecl PAL_wcsspn (const WCHAR *, const WCHAR *);
PALIMPORT double __cdecl PAL_wcstod(const WCHAR *, WCHAR **);
PALIMPORT int __cdecl PAL_iswalpha(WCHAR);
-PALIMPORT int __cdecl PAL_iswprint(WCHAR);
+PALIMPORT DLLEXPORT int __cdecl PAL_iswprint(WCHAR);
PALIMPORT int __cdecl PAL_iswupper(WCHAR);
-PALIMPORT int __cdecl PAL_iswspace(WCHAR);
+PALIMPORT DLLEXPORT int __cdecl PAL_iswspace(WCHAR);
PALIMPORT int __cdecl PAL_iswdigit(WCHAR);
PALIMPORT int __cdecl PAL_iswxdigit(WCHAR);
PALIMPORT WCHAR __cdecl PAL_towlower(WCHAR);
PALIMPORT WCHAR __cdecl PAL_towupper(WCHAR);
PALIMPORT WCHAR * __cdecl _wcslwr(WCHAR *);
-PALIMPORT ULONGLONG _wcstoui64(const WCHAR *, WCHAR **, int);
-PALIMPORT errno_t __cdecl _i64tow_s(long long, WCHAR *, size_t, int);
+PALIMPORT DLLEXPORT ULONGLONG _wcstoui64(const WCHAR *, WCHAR **, int);
+PALIMPORT DLLEXPORT errno_t __cdecl _i64tow_s(long long, WCHAR *, size_t, int);
PALIMPORT int __cdecl _wtoi(const WCHAR *);
#ifdef __cplusplus
@@ -4581,9 +4579,9 @@ inline __int64 abs(__int64 _X) {
}
#endif
-PALIMPORT void * __cdecl malloc(size_t);
-PALIMPORT void __cdecl free(void *);
-PALIMPORT void * __cdecl realloc(void *, size_t);
+PALIMPORT DLLEXPORT void * __cdecl malloc(size_t);
+PALIMPORT DLLEXPORT void __cdecl free(void *);
+PALIMPORT DLLEXPORT void * __cdecl realloc(void *, size_t);
PALIMPORT char * __cdecl _strdup(const char *);
#if defined(_MSC_VER)
@@ -4602,7 +4600,7 @@ PALIMPORT char * __cdecl _strdup(const char *);
PALIMPORT PAL_NORETURN void __cdecl exit(int);
int __cdecl atexit(void (__cdecl *function)(void));
-PALIMPORT void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)(const void *, const 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 *));
@@ -4630,7 +4628,7 @@ PALIMPORT char * __cdecl ctime(const time_t *);
PALIMPORT int __cdecl _open_osfhandle(INT_PTR, int);
PALIMPORT int __cdecl _close(int);
-PALIMPORT int __cdecl _flushall();
+PALIMPORT DLLEXPORT int __cdecl _flushall();
#ifdef PAL_STDCPP_COMPAT
@@ -4663,14 +4661,14 @@ typedef struct _FILE PAL_FILE;
PALIMPORT int __cdecl PAL_fclose(PAL_FILE *);
PALIMPORT void __cdecl PAL_setbuf(PAL_FILE *, char*);
-PALIMPORT int __cdecl PAL_fflush(PAL_FILE *);
+PALIMPORT DLLEXPORT int __cdecl PAL_fflush(PAL_FILE *);
PALIMPORT size_t __cdecl PAL_fwrite(const void *, size_t, size_t, PAL_FILE *);
PALIMPORT size_t __cdecl PAL_fread(void *, size_t, size_t, PAL_FILE *);
PALIMPORT char * __cdecl PAL_fgets(char *, int, PAL_FILE *);
PALIMPORT int __cdecl PAL_fputs(const char *, PAL_FILE *);
PALIMPORT int __cdecl PAL_fputc(int c, PAL_FILE *stream);
PALIMPORT int __cdecl PAL_putchar(int c);
-PALIMPORT int __cdecl PAL_fprintf(PAL_FILE *, const char *, ...);
+PALIMPORT DLLEXPORT int __cdecl PAL_fprintf(PAL_FILE *, const char *, ...);
PALIMPORT int __cdecl PAL_vfprintf(PAL_FILE *, const char *, va_list);
PALIMPORT int __cdecl PAL_fseek(PAL_FILE *, LONG, int);
PALIMPORT LONG __cdecl PAL_ftell(PAL_FILE *);
@@ -4682,7 +4680,7 @@ PALIMPORT int __cdecl PAL_fgetc(PAL_FILE *stream);
PALIMPORT int __cdecl PAL_ungetc(int c, PAL_FILE *stream);
PALIMPORT int __cdecl PAL_setvbuf(PAL_FILE *stream, char *, int, size_t);
PALIMPORT WCHAR * __cdecl PAL_fgetws(WCHAR *, int, PAL_FILE *);
-PALIMPORT int __cdecl PAL_fwprintf(PAL_FILE *, const WCHAR *, ...);
+PALIMPORT DLLEXPORT int __cdecl PAL_fwprintf(PAL_FILE *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vfwprintf(PAL_FILE *, const WCHAR *, va_list);
PALIMPORT int __cdecl PAL_wprintf(const WCHAR*, ...);
@@ -4701,7 +4699,7 @@ PALIMPORT PAL_FILE * __cdecl _wfsopen(const WCHAR *, const WCHAR *, int);
PALIMPORT int __cdecl rand(void);
PALIMPORT void __cdecl srand(unsigned int);
-PALIMPORT int __cdecl printf(const char *, ...);
+PALIMPORT DLLEXPORT int __cdecl printf(const char *, ...);
PALIMPORT int __cdecl vprintf(const char *, va_list);
#ifdef _MSC_VER
@@ -4710,10 +4708,10 @@ PALIMPORT int __cdecl vprintf(const char *, va_list);
#define PAL_get_caller 0
#endif
-PALIMPORT PAL_FILE * __cdecl PAL_get_stdout(int caller);
+PALIMPORT DLLEXPORT PAL_FILE * __cdecl PAL_get_stdout(int caller);
PALIMPORT PAL_FILE * __cdecl PAL_get_stdin(int caller);
-PALIMPORT PAL_FILE * __cdecl PAL_get_stderr(int caller);
-PALIMPORT int * __cdecl PAL_errno(int caller);
+PALIMPORT DLLEXPORT PAL_FILE * __cdecl PAL_get_stderr(int caller);
+PALIMPORT DLLEXPORT int * __cdecl PAL_errno(int caller);
#ifdef PAL_STDCPP_COMPAT
#define PAL_stdout (PAL_get_stdout(PAL_get_caller))
diff --git a/src/pal/inc/pal_mstypes.h b/src/pal/inc/pal_mstypes.h
index 9f305c626d..78c6b042dd 100644
--- a/src/pal/inc/pal_mstypes.h
+++ b/src/pal/inc/pal_mstypes.h
@@ -96,17 +96,20 @@ extern "C" {
#else
#define PALIMPORT __declspec(dllimport)
#endif
+#define DLLEXPORT __declspec(dllexport)
#define PAL_NORETURN __declspec(noreturn)
#else
#define PALIMPORT
+#define DLLEXPORT __attribute__((visibility("default")))
#define PAL_NORETURN __attribute__((noreturn))
#endif
-#define PALAPI __cdecl
-#define PALAPIV __cdecl
+#define PALAPI DLLEXPORT __cdecl
+#define PALAPI_NOEXPORT __cdecl
+#define PALAPIV __cdecl
////////////////////////////////////////////////////////////////////////
// Type attribute stuff
diff --git a/src/pal/inc/rt/guiddef.h b/src/pal/inc/rt/guiddef.h
index 12e51c8fc6..392df60075 100644
--- a/src/pal/inc/rt/guiddef.h
+++ b/src/pal/inc/rt/guiddef.h
@@ -18,7 +18,7 @@
#ifdef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
- EXTERN_C const GUID DECLSPEC_SELECTANY name \
+ EXTERN_C DLLEXPORT const GUID DECLSPEC_SELECTANY name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index 9ff6ea5164..78190fcdd1 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -388,10 +388,10 @@ typedef WCHAR *BSTR;
STDAPI_(BSTR) SysAllocString(const OLECHAR*);
STDAPI_(BSTR) SysAllocStringLen(const OLECHAR*, UINT);
-STDAPI_(BSTR) SysAllocStringByteLen(const char *, UINT);
+DLLEXPORT STDAPI_(BSTR) SysAllocStringByteLen(const char *, UINT);
STDAPI_(void) SysFreeString(BSTR);
STDAPI_(UINT) SysStringLen(BSTR);
-STDAPI_(UINT) SysStringByteLen(BSTR);
+DLLEXPORT STDAPI_(UINT) SysStringByteLen(BSTR);
typedef double DATE;
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index be5b5bd872..829638b693 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -295,10 +295,18 @@ add_library(coreclrpal
${LIBUNWIND_OBJECTS}
)
-add_library(tracepointprovider
- STATIC
- misc/tracepointprovider.cpp
-)
+# There is only one function exported in 'tracepointprovider.cpp' namely 'PAL_InitializeTracing',
+# which is guarded with '#if defined(__linux__)'. On macOS, Xcode issues the following warning:
+#
+# > warning: /Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
+# > warning for library: libtracepointprovider.a the table of contents is empty (no object file members in the library define global symbols)
+#
+if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+ add_library(tracepointprovider
+ STATIC
+ misc/tracepointprovider.cpp
+ )
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
find_library(COREFOUNDATION CoreFoundation)
diff --git a/src/pal/src/cruntime/misc.cpp b/src/pal/src/cruntime/misc.cpp
index 9e5acf65ff..68427f52c9 100644
--- a/src/pal/src/cruntime/misc.cpp
+++ b/src/pal/src/cruntime/misc.cpp
@@ -138,7 +138,6 @@ Function:
See MSDN for more details.
--*/
-
PAL_time_t
__cdecl
PAL_mktime(struct PAL_tm *tm)
@@ -215,7 +214,6 @@ PAL_time(PAL_time_t *tloc)
return result;
}
-
PALIMPORT
void __cdecl
PAL_qsort(void *base, size_t nmemb, size_t size,
@@ -245,6 +243,7 @@ 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,
@@ -300,6 +299,7 @@ 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/include/pal/module.h b/src/pal/src/include/pal/module.h
index aacc326c64..66ac23834a 100644
--- a/src/pal/src/include/pal/module.h
+++ b/src/pal/src/include/pal/module.h
@@ -25,9 +25,9 @@ extern "C"
{
#endif // __cplusplus
-typedef BOOL (PALAPI *PDLLMAIN)(HINSTANCE, DWORD, LPVOID); /* entry point of module */
-typedef HINSTANCE (PALAPI *PREGISTER_MODULE)(LPCSTR); /* used to create the HINSTANCE for above DLLMain entry point */
-typedef VOID (PALAPI *PUNREGISTER_MODULE)(HINSTANCE); /* used to cleanup the HINSTANCE for above DLLMain entry point */
+typedef BOOL (PALAPI_NOEXPORT *PDLLMAIN)(HINSTANCE, DWORD, LPVOID); /* entry point of module */
+typedef HINSTANCE (PALAPI_NOEXPORT *PREGISTER_MODULE)(LPCSTR); /* used to create the HINSTANCE for above DLLMain entry point */
+typedef VOID (PALAPI_NOEXPORT *PUNREGISTER_MODULE)(HINSTANCE); /* used to cleanup the HINSTANCE for above DLLMain entry point */
typedef struct _MODSTRUCT
{
diff --git a/src/pal/src/locale/unicode_data.cpp b/src/pal/src/locale/unicode_data.cpp
index f9ba166f11..4f7a51fc90 100644
--- a/src/pal/src/locale/unicode_data.cpp
+++ b/src/pal/src/locale/unicode_data.cpp
@@ -22,7 +22,7 @@ Abstract:
#if !HAVE_COREFOUNDATION
-CONST UnicodeDataRec UnicodeData[] = {
+CONST UnicodeDataRec UnicodeData[] DLLEXPORT = {
{ 0x0000, 0x0020, 0x0000, 0 },
@@ -1846,7 +1846,7 @@ CONST UnicodeDataRec UnicodeData[] = {
{ 0xffe0, 0x0010, 0x0000, 13 },
};
-CONST UINT UNICODE_DATA_SIZE = sizeof(UnicodeData)/sizeof(UnicodeDataRec);
-CONST UINT UNICODE_DATA_DIRECT_ACCESS = 256;
+CONST UINT UNICODE_DATA_SIZE DLLEXPORT = sizeof(UnicodeData)/sizeof(UnicodeDataRec);
+CONST UINT UNICODE_DATA_DIRECT_ACCESS DLLEXPORT = 256;
#endif // !HAVE_COREFOUNDATION
diff --git a/src/pal/src/misc/environ.cpp b/src/pal/src/misc/environ.cpp
index 9fc13467c5..f73d7ec71f 100644
--- a/src/pal/src/misc/environ.cpp
+++ b/src/pal/src/misc/environ.cpp
@@ -1050,6 +1050,7 @@ 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 )
@@ -1079,7 +1080,7 @@ Function : PAL_getenv
See MSDN for more details.
--*/
-char * __cdecl PAL_getenv(const char *varname)
+DLLEXPORT char * __cdecl PAL_getenv(const char *varname)
{
char *retval;
diff --git a/src/pal/src/safecrt/mbusafecrt_internal.h b/src/pal/src/safecrt/mbusafecrt_internal.h
index 9a3aa1ca90..973c8695bf 100644
--- a/src/pal/src/safecrt/mbusafecrt_internal.h
+++ b/src/pal/src/safecrt/mbusafecrt_internal.h
@@ -21,6 +21,14 @@
#include "pal_char16.h"
#include "pal_mstypes.h"
+#ifndef DLLEXPORT
+#ifdef _MSC_VER
+#define DLLEXPORT __declspec(dllexport)
+#else
+#define DLLEXPORT __attribute__ ((visibility ("default")))
+#endif // _MSC_VER
+#endif // !DLLEXPORT
+
typedef __builtin_va_list va_list;
// The ifdef below are to accommodate Unix build
diff --git a/src/pal/src/safecrt/memcpy_s.cpp b/src/pal/src/safecrt/memcpy_s.cpp
index a75ec41861..db3bb5f1fc 100644
--- a/src/pal/src/safecrt/memcpy_s.cpp
+++ b/src/pal/src/safecrt/memcpy_s.cpp
@@ -49,7 +49,7 @@
*
*******************************************************************************/
-errno_t __cdecl memcpy_s(
+DLLEXPORT errno_t __cdecl memcpy_s(
void * dst,
size_t sizeInBytes,
const void * src,
diff --git a/src/pal/src/safecrt/sprintf_s.cpp b/src/pal/src/safecrt/sprintf_s.cpp
index edfb768670..79a4e4345b 100644
--- a/src/pal/src/safecrt/sprintf_s.cpp
+++ b/src/pal/src/safecrt/sprintf_s.cpp
@@ -65,8 +65,7 @@
*Exceptions:
*
*******************************************************************************/
-
-int sprintf_s (
+DLLEXPORT int sprintf_s (
char *string,
size_t sizeInBytes,
const char *format,
@@ -81,7 +80,7 @@ int sprintf_s (
return ret;
}
-int _snprintf_s (
+DLLEXPORT int _snprintf_s (
char *string,
size_t sizeInBytes,
size_t count,
diff --git a/src/pal/src/safecrt/sscanf_s.cpp b/src/pal/src/safecrt/sscanf_s.cpp
index 7a481b580f..686513d3df 100644
--- a/src/pal/src/safecrt/sscanf_s.cpp
+++ b/src/pal/src/safecrt/sscanf_s.cpp
@@ -189,7 +189,7 @@ static int __cdecl vnwscan_fn (
*
*******************************************************************************/
-int __cdecl sscanf_s (
+DLLEXPORT int __cdecl sscanf_s (
const char *string,
const char *format,
...
diff --git a/src/pal/src/safecrt/swprintf.cpp b/src/pal/src/safecrt/swprintf.cpp
index 2fbfcfaf58..1d8cf420b0 100644
--- a/src/pal/src/safecrt/swprintf.cpp
+++ b/src/pal/src/safecrt/swprintf.cpp
@@ -80,7 +80,7 @@
*
*******************************************************************************/
-int __cdecl swprintf_s (
+DLLEXPORT int __cdecl swprintf_s (
wchar_t *string,
size_t sizeInWords,
const wchar_t *format,
@@ -99,7 +99,7 @@ int __cdecl swprintf_s (
return ret;
}
-int __cdecl _snwprintf_s (
+DLLEXPORT int __cdecl _snwprintf_s (
wchar_t *string,
size_t sizeInWords,
size_t count,
diff --git a/src/pal/src/safecrt/vsprintf.cpp b/src/pal/src/safecrt/vsprintf.cpp
index e1a94d086d..6d4b786984 100644
--- a/src/pal/src/safecrt/vsprintf.cpp
+++ b/src/pal/src/safecrt/vsprintf.cpp
@@ -119,7 +119,7 @@ int __cdecl _vsnprintf_helper (
return -1;
}
-int __cdecl vsprintf_s (
+DLLEXPORT int __cdecl vsprintf_s (
char *string,
size_t sizeInBytes,
const char *format,
@@ -150,7 +150,7 @@ int __cdecl vsprintf_s (
return retvalue;
}
-int __cdecl _vsnprintf_s (
+DLLEXPORT int __cdecl _vsnprintf_s (
char *string,
size_t sizeInBytes,
size_t count,
diff --git a/src/pal/src/safecrt/vswprint.cpp b/src/pal/src/safecrt/vswprint.cpp
index b9940a693a..3f814120f1 100644
--- a/src/pal/src/safecrt/vswprint.cpp
+++ b/src/pal/src/safecrt/vswprint.cpp
@@ -112,7 +112,7 @@ int __cdecl _vswprintf_helper (
return -1;
}
-int __cdecl vswprintf_s (
+DLLEXPORT int __cdecl vswprintf_s (
wchar_t *string,
size_t sizeInWords,
const wchar_t *format,
@@ -143,7 +143,7 @@ int __cdecl vswprintf_s (
return retvalue;
}
-int __cdecl _vsnwprintf_s (
+DLLEXPORT int __cdecl _vsnwprintf_s (
wchar_t *string,
size_t sizeInWords,
size_t count,
diff --git a/src/pal/src/safecrt/xtoa_s.cpp b/src/pal/src/safecrt/xtoa_s.cpp
index 42cc5786d1..2857beab07 100644
--- a/src/pal/src/safecrt/xtoa_s.cpp
+++ b/src/pal/src/safecrt/xtoa_s.cpp
@@ -12,7 +12,7 @@
* via repeated calls.
*
*******************************************************************************/
-
+#include "pal/palinternal.h"
#include <string.h>
#include <errno.h>
#include <limits.h>
diff --git a/src/pal/src/safecrt/xtox_s.inl b/src/pal/src/safecrt/xtox_s.inl
index 7c8b2f2fd6..2ad59e5825 100644
--- a/src/pal/src/safecrt/xtox_s.inl
+++ b/src/pal/src/safecrt/xtox_s.inl
@@ -154,7 +154,7 @@ static void __stdcall xtox
and return pointer to buffer. */
#ifdef _SECURE_ITOA
-errno_t __cdecl _itox_s (
+DLLEXPORT errno_t __cdecl _itox_s (
int val,
TCHAR *buf,
size_t sizeInTChars,
@@ -359,7 +359,7 @@ static void __fastcall x64tox
/* Actual functions just call conversion helper with neg flag set correctly,
and return pointer to buffer. */
-errno_t __cdecl _i64tox_s (
+DLLEXPORT errno_t __cdecl _i64tox_s (
long long val,
TCHAR *buf,
size_t sizeInTChars,
diff --git a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp
index 22602bfa07..bbcb664bfe 100644
--- a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp
+++ b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp
@@ -15,7 +15,9 @@
#include <palsuite.h>
extern "C"
-int InitializeDllTest1()
+int
+PALAPI
+InitializeDllTest1()
{
PAL_SetInitializeDLLFlags(PAL_INITIALIZE_DLL | PAL_INITIALIZE_REGISTER_SIGNALS);
return PAL_InitializeDLL();
@@ -36,7 +38,9 @@ BOOL bTry = FALSE;
BOOL bExcept = FALSE;
extern "C"
-int DllTest1()
+int
+PALAPI
+DllTest1()
{
Trace("Starting pal_sxs test1 DllTest1\n");
diff --git a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp
index 222898f812..084d990404 100644
--- a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp
+++ b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp
@@ -15,7 +15,9 @@
#include <palsuite.h>
extern "C"
-int InitializeDllTest2()
+int
+PALAPI
+InitializeDllTest2()
{
PAL_SetInitializeDLLFlags(PAL_INITIALIZE_DLL | PAL_INITIALIZE_REGISTER_SIGNALS);
return PAL_InitializeDLL();
@@ -36,7 +38,9 @@ BOOL bTry = FALSE;
BOOL bExcept = FALSE;
extern "C"
-int DllTest2()
+int
+PALAPI
+DllTest2()
{
Trace("Starting pal_sxs test1 DllTest2\n");
diff --git a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp
index 5515ae4562..7b89dfeb2b 100644
--- a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp
+++ b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp
@@ -15,7 +15,7 @@
**===========================================================================*/
#include <palsuite.h>
-typedef int (PALAPI *SIMPLEFUNCTION)(int);
+typedef int (PALAPI_NOEXPORT *SIMPLEFUNCTION)(int);
/* SHLEXT is defined only for Unix variants */
#if defined(SHLEXT)
diff --git a/src/palrt/bstr.cpp b/src/palrt/bstr.cpp
index ae22b15a10..8b3cc36620 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.
*
***********************************************************************/
-STDAPI_(BSTR) SysAllocStringLen(const OLECHAR *psz, UINT len)
+DLLEXPORT STDAPI_(BSTR) SysAllocStringLen(const OLECHAR *psz, UINT len)
{
BSTR bstr;
@@ -168,7 +168,7 @@ SysAllocStringByteLen(const char FAR* psz, unsigned int len)
* None
*
***********************************************************************/
-STDAPI_(void) SysFreeString(BSTR bstr)
+DLLEXPORT STDAPI_(void) SysFreeString(BSTR bstr)
{
if(bstr == NULL)
return;
@@ -187,7 +187,7 @@ STDAPI_(void) SysFreeString(BSTR bstr)
* return value = unsigned int, length in characters.
*
***********************************************************************/
-STDAPI_(unsigned int)
+DLLEXPORT STDAPI_(unsigned int)
SysStringLen(BSTR bstr)
{
if(bstr == NULL)
diff --git a/src/palrt/comem.cpp b/src/palrt/comem.cpp
index e44550d365..e0069d224f 100644
--- a/src/palrt/comem.cpp
+++ b/src/palrt/comem.cpp
@@ -11,17 +11,17 @@
#include "common.h"
-STDAPI_(LPVOID) CoTaskMemAlloc(SIZE_T cb)
+DLLEXPORT STDAPI_(LPVOID) CoTaskMemAlloc(SIZE_T cb)
{
return LocalAlloc(LMEM_FIXED, cb);
}
-STDAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, SIZE_T cb)
+DLLEXPORT STDAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, SIZE_T cb)
{
return LocalReAlloc(pv, cb, LMEM_MOVEABLE);
}
-STDAPI_(void) CoTaskMemFree(LPVOID pv)
+DLLEXPORT STDAPI_(void) CoTaskMemFree(LPVOID pv)
{
LocalFree(pv);
}
diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp
index 6071a56151..26308e53aa 100644
--- a/src/utilcode/ccomprc.cpp
+++ b/src/utilcode/ccomprc.cpp
@@ -11,7 +11,7 @@
#ifdef FEATURE_PAL
#include "resourcestring.h"
#define NATIVE_STRING_RESOURCE_NAME mscorrc_debug
-DECLARE_NATIVE_STRING_RESOURCE_TABLE(NATIVE_STRING_RESOURCE_NAME);
+__attribute__((visibility("default"))) DECLARE_NATIVE_STRING_RESOURCE_TABLE(NATIVE_STRING_RESOURCE_NAME);
#endif
#include "sstring.h"
#include "stringarraylist.h"
diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp
index e949af29a6..051a003bfe 100644
--- a/src/vm/appdomain.hpp
+++ b/src/vm/appdomain.hpp
@@ -838,7 +838,7 @@ public:
}
#endif // DACCESS_COMPILE
- DEBUG_NOINLINE static void HolderEnter(PEFileListLock *pThis) PUB
+ DEBUG_NOINLINE static void HolderEnter(PEFileListLock *pThis)
{
WRAPPER_NO_CONTRACT;
ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;
@@ -846,7 +846,7 @@ public:
pThis->Enter();
}
- DEBUG_NOINLINE static void HolderLeave(PEFileListLock *pThis) PUB
+ DLLEXPORT DEBUG_NOINLINE static void HolderLeave(PEFileListLock *pThis)
{
WRAPPER_NO_CONTRACT;
ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index 82bf0e4dfe..9f8aeb766b 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -1171,6 +1171,7 @@ HRESULT CorRuntimeHostBase::EnumDomains(HDOMAINENUM *hEnum)
#endif // FEATURE_COMINTEROP
extern "C"
+DLLEXPORT
HRESULT GetCLRRuntimeHost(REFIID riid, IUnknown **ppUnk)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/vm/crst.h b/src/vm/crst.h
index 5289dfa9f4..33c0b84dd8 100644
--- a/src/vm/crst.h
+++ b/src/vm/crst.h
@@ -183,13 +183,13 @@ private:
void SpinEnter();
#ifndef DACCESS_COMPILE
- DEBUG_NOINLINE static void AcquireLock(CrstBase *c) PUB {
+ DEBUG_NOINLINE static void AcquireLock(CrstBase *c) {
WRAPPER_NO_CONTRACT;
ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;
c->Enter();
}
- DEBUG_NOINLINE static void ReleaseLock(CrstBase *c) PUB {
+ DLLEXPORT DEBUG_NOINLINE static void ReleaseLock(CrstBase *c) {
WRAPPER_NO_CONTRACT;
ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;
c->Leave();
@@ -202,8 +202,8 @@ private:
// Argument:
// input: c - the lock to be checked.
// Note: Throws
- static void AcquireLock(CrstBase * c) PUB
- {
+ DLLEXPORT static void AcquireLock(CrstBase * c)
+ {
SUPPORTS_DAC;
if (c->GetEnterCount() != 0)
{
@@ -211,8 +211,8 @@ private:
}
};
- static void ReleaseLock(CrstBase *c) PUB
- {
+ DLLEXPORT static void ReleaseLock(CrstBase *c)
+ {
SUPPORTS_DAC;
};
#endif // DACCESS_COMPILE
@@ -537,5 +537,3 @@ __inline BOOL IsOwnerOfCrst(LPVOID lock)
void DebugTryCrst(CrstBase * pLock);
#endif
#endif // __crst_h__
-
-
diff --git a/src/vm/listlock.h b/src/vm/listlock.h
index 8b356701b7..25c7f492ed 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
- DEBUG_NOINLINE static void LockHolderEnter(Entry_t *pThis) PUB
+ DLLEXPORT DEBUG_NOINLINE static void LockHolderEnter(Entry_t *pThis)
{
WRAPPER_NO_CONTRACT;
ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;
pThis->Enter();
}
- DEBUG_NOINLINE static void LockHolderLeave(Entry_t *pThis) PUB
+ DLLEXPORT DEBUG_NOINLINE static void LockHolderLeave(Entry_t *pThis)
{
WRAPPER_NO_CONTRACT;
ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT;