From e5994fa5507a5f08058193ff26dc3698cd2e6444 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Tue, 7 Mar 2017 20:27:35 +0900 Subject: [x86/Linux] CDECL as default P/Invoke Calling Convetion (#9977) * [x86/Linux] CDECL as default P/Invoke Calling Convetion --- .../palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp | 4 ++-- .../FreeLibraryAndExitThread/test1/dlltest.cpp | 4 ++-- .../palsuite/filemapping_memmgt/GetProcAddress/test1/test1.cpp | 2 +- .../palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp | 4 ++-- .../palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp | 4 ++-- src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp | 4 ++-- src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp | 4 ++-- .../palsuite/pal_specific/pal_entrypoint/test1/palstartup.h | 9 ++++++--- .../palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp | 4 ++-- .../threading/DisableThreadLibraryCalls/test1/testlib.cpp | 6 +++--- .../threading/DisableThreadLibraryCalls/test2/dllmain1.cpp | 2 +- .../threading/DisableThreadLibraryCalls/test2/dllmain2.cpp | 2 +- src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp | 2 +- 13 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src/pal/tests') diff --git a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp index 44f1b5a903..3e6cff292e 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibrary/test1/dlltest.cpp @@ -19,13 +19,13 @@ __declspec(dllexport) #endif -int __stdcall DllTest() +int PALAPI DllTest() { return 1; } #ifdef WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp index 954c624d19..e66a9ebdbe 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/dlltest.cpp @@ -19,13 +19,13 @@ __declspec(dllexport) #endif -int _stdcall DllTest() +int PALAPI DllTest() { return 1; } #if WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void * lpvReserved) { return 1; } 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 f0b76c615f..5515ae4562 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 -typedef int (__stdcall *SIMPLEFUNCTION)(int); +typedef int (PALAPI *SIMPLEFUNCTION)(int); /* SHLEXT is defined only for Unix variants */ #if defined(SHLEXT) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp index e8fe48e05d..7b87ba7f79 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test1/testlib.cpp @@ -20,13 +20,13 @@ __declspec(dllexport) /** * Simple function that returns i+1 */ -int __stdcall SimpleFunction(int i) +int PALAPI SimpleFunction(int i) { return i+1; } #if WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp index 23e58e871e..47299a1b1f 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/GetProcAddress/test2/testlib.cpp @@ -20,13 +20,13 @@ __declspec(dllexport) /** * Simple function that returns i+1 */ -int __stdcall SimpleFunction(int i) +int PALAPI SimpleFunction(int i) { return i+1; } #if WIN32 -int __stdcall _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) +int PALAPI _DllMainCRTStartup(void *hinstDLL, int reason, void *lpvReserved) { return 1; } diff --git a/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp b/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp index 72380eebb5..372657605b 100644 --- a/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp +++ b/src/pal/tests/palsuite/loader/LoadLibraryA/test6/dlltest.cpp @@ -23,7 +23,7 @@ static int g_attachCount = 0; /* standard DllMain() */ -BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { switch( reason ) { @@ -53,7 +53,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) } #if _WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { return DllMain(hinstDLL, reason, lpvReserved); } diff --git a/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp b/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp index 72380eebb5..372657605b 100644 --- a/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp +++ b/src/pal/tests/palsuite/loader/LoadLibraryA/test8/dlltest.cpp @@ -23,7 +23,7 @@ static int g_attachCount = 0; /* standard DllMain() */ -BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { switch( reason ) { @@ -53,7 +53,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) } #if _WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { return DllMain(hinstDLL, reason, lpvReserved); } diff --git a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h index 862870be99..1947b59b77 100644 --- a/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h +++ b/src/pal/tests/palsuite/pal_specific/pal_entrypoint/test1/palstartup.h @@ -27,6 +27,11 @@ static DWORD PALAPI run_main(struct _mainargs *args) return (DWORD) PAL_startup_main(args->argc, args->argv); } +static void terminate(void) +{ + PAL_Terminate(); +} + int __cdecl main(int argc, char **argv) { struct _mainargs mainargs; @@ -34,9 +39,7 @@ int __cdecl main(int argc, char **argv) { return FAIL;; } - // PAL_Terminate is a stdcall function, but it takes no parameters - // so the difference doesn't matter. - atexit((void (__cdecl *)(void)) PAL_Terminate); + atexit(terminate); mainargs.argc = argc; mainargs.argv = argv; diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp index b64fd0c7d2..55251d46bf 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/test1.cpp @@ -26,7 +26,7 @@ #define GETCALLCOUNT "_GetCallCount@0" #endif -DWORD __stdcall ThreadFunc(LPVOID lpParam); +DWORD PALAPI ThreadFunc(LPVOID lpParam); int RunTest(int DisableThreadCalls); int __cdecl main(int argc, char **argv) @@ -78,7 +78,7 @@ int __cdecl main(int argc, char **argv) /* * Thread entry point. Doesn't do anything. */ -DWORD __stdcall ThreadFunc(LPVOID lpParam) +DWORD PALAPI ThreadFunc(LPVOID lpParam) { return 0; } diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp index 53b66d1357..057dfde66d 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test1/testlib.cpp @@ -15,7 +15,7 @@ static int Count; -BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) @@ -32,7 +32,7 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } @@ -41,7 +41,7 @@ BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lp #ifdef WIN32 __declspec(dllexport) #endif -int __stdcall GetCallCount() +int PALAPI GetCallCount() { return Count; } diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp index 5010a27665..b65bb66a56 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain1.cpp @@ -50,7 +50,7 @@ BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } diff --git a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp index 4e3f8862a4..519083bbaf 100644 --- a/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp +++ b/src/pal/tests/palsuite/threading/DisableThreadLibraryCalls/test2/dllmain2.cpp @@ -50,7 +50,7 @@ BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } diff --git a/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp b/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp index 923650d1d3..862aff5f00 100644 --- a/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp +++ b/src/pal/tests/palsuite/threading/ExitThread/test3/dllmain.cpp @@ -48,7 +48,7 @@ BOOL PALAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) } #ifdef WIN32 -BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL PALAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return DllMain(hinstDLL, fdwReason, lpvReserved); } -- cgit v1.2.3