summaryrefslogtreecommitdiff
path: root/tests/src/Interop
diff options
context:
space:
mode:
authorYi Zhang (CLR) <yzha@microsoft.com>2016-05-02 21:00:21 -0700
committerYi Zhang (CLR) <yzha@microsoft.com>2016-05-03 08:53:15 -0700
commitdfef0a390443379c3991b97d8871f301321c36f6 (patch)
tree9193a4b0c3d18c27359d5f856bebf2d87f25bbf2 /tests/src/Interop
parentb2dc8a1d6f6ed13549a240e1ebbfc7d3306830e6 (diff)
downloadcoreclr-dfef0a390443379c3991b97d8871f301321c36f6.tar.gz
coreclr-dfef0a390443379c3991b97d8871f301321c36f6.tar.bz2
coreclr-dfef0a390443379c3991b97d8871f301321c36f6.zip
Fix calling convention mismatch in 7 interop tests and enable [NativeCallable] in all architectures.
Diffstat (limited to 'tests/src/Interop')
-rw-r--r--tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamManaged.csbin2480 -> 1253 bytes
-rw-r--r--tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamNative.cpp10
-rw-r--r--tests/src/Interop/MarshalAPI/FunctionPointer/GetFcnPtrForDel_Negative_Security.cs4
-rw-r--r--tests/src/Interop/MarshalAPI/IUnknown/IUnknownNative.cpp2
-rw-r--r--tests/src/Interop/NativeCallable/NativeCallableDll.cpp2
-rw-r--r--tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/MarshalEnumNative.cpp4
-rwxr-xr-xtests/src/Interop/RefInt/RefIntNative.cpp4
-rw-r--r--tests/src/Interop/SimpleStruct/SimpleStructNative.cpp10
-rw-r--r--tests/src/Interop/common/xplatform.h2
9 files changed, 19 insertions, 19 deletions
diff --git a/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamManaged.cs b/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamManaged.cs
index 324f9a22a8..31c7535d47 100644
--- a/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamManaged.cs
+++ b/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamManaged.cs
Binary files differ
diff --git a/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamNative.cpp b/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamNative.cpp
index 9c9d36dbef..796f1ca3ba 100644
--- a/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamNative.cpp
+++ b/tests/src/Interop/FuncPtrAsDelegateParam/FuncPtrAsDelegateParamNative.cpp
@@ -8,14 +8,14 @@
//Cdecl -1 678
-int WINAPI CdeTest()
+int _cdecl CdeTest()
{
return -1;
}
-typedef int (WINAPI *pFunc)();
-typedef int (WINAPI *Cdeclcaller)(pFunc);
-extern "C" DLL_EXPORT BOOL WINAPI DoCallBack_Cdecl(Cdeclcaller caller)
+typedef int (_cdecl *pFunc)();
+typedef int (_cdecl *Cdeclcaller)(pFunc);
+extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_Cdecl(Cdeclcaller caller)
{
printf("DoCallBack_Cdecl\n");
@@ -25,4 +25,4 @@ extern "C" DLL_EXPORT BOOL WINAPI DoCallBack_Cdecl(Cdeclcaller caller)
return FALSE;
}
return TRUE;
-} \ No newline at end of file
+}
diff --git a/tests/src/Interop/MarshalAPI/FunctionPointer/GetFcnPtrForDel_Negative_Security.cs b/tests/src/Interop/MarshalAPI/FunctionPointer/GetFcnPtrForDel_Negative_Security.cs
index 3724404d59..de74495caf 100644
--- a/tests/src/Interop/MarshalAPI/FunctionPointer/GetFcnPtrForDel_Negative_Security.cs
+++ b/tests/src/Interop/MarshalAPI/FunctionPointer/GetFcnPtrForDel_Negative_Security.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
partial class FunctionPtr
{
- [DllImport("FunctionPointerNative")]
+ [DllImport("FunctionPointerNative", CallingConvention=CallingConvention.Cdecl)]
public static extern bool CheckFcnPtr(IntPtr fcnptr);
public delegate bool DelegateWithLong(long l); //Singlecast delegate
@@ -84,4 +84,4 @@ partial class FunctionPtr
throw new Exception("Failed multicast call");
}
}
-#pragma warning restore 618 \ No newline at end of file
+#pragma warning restore 618
diff --git a/tests/src/Interop/MarshalAPI/IUnknown/IUnknownNative.cpp b/tests/src/Interop/MarshalAPI/IUnknown/IUnknownNative.cpp
index 674c3fb297..bdc382be7e 100644
--- a/tests/src/Interop/MarshalAPI/IUnknown/IUnknownNative.cpp
+++ b/tests/src/Interop/MarshalAPI/IUnknown/IUnknownNative.cpp
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <xplatform.h>
-extern "C" DLL_EXPORT BOOL __stdcall Marshal_IUnknown(/*[in]*/IUnknown *o)
+extern "C" DLL_EXPORT BOOL _cdecl Marshal_IUnknown(/*[in]*/IUnknown *o)
{
//Call AddRef and Release on the passed IUnknown
//test if the ref counts get updated as expected
diff --git a/tests/src/Interop/NativeCallable/NativeCallableDll.cpp b/tests/src/Interop/NativeCallable/NativeCallableDll.cpp
index 6ba63ff875..0eb82914f1 100644
--- a/tests/src/Interop/NativeCallable/NativeCallableDll.cpp
+++ b/tests/src/Interop/NativeCallable/NativeCallableDll.cpp
@@ -4,7 +4,7 @@
#include <xplatform.h>
-typedef int (*CALLBACKADDPROC)(int n);
+typedef int (WINAPI *CALLBACKADDPROC)(int n);
extern "C" DLL_EXPORT int WINAPI CallManagedAdd(CALLBACKADDPROC pCallbackAddProc, int n)
{
diff --git a/tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/MarshalEnumNative.cpp b/tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/MarshalEnumNative.cpp
index c1e37ca4bf..3d8f861547 100644
--- a/tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/MarshalEnumNative.cpp
+++ b/tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/MarshalEnumNative.cpp
@@ -5,7 +5,7 @@
typedef void *voidPtr;
-extern "C" DLL_EXPORT long WINAPI CdeclEnum(int r,BOOL *result)
+extern "C" DLL_EXPORT long _cdecl CdeclEnum(int r,BOOL *result)
{
if(r != 3)
{
@@ -17,7 +17,7 @@ extern "C" DLL_EXPORT long WINAPI CdeclEnum(int r,BOOL *result)
}
-extern "C" DLL_EXPORT voidPtr WINAPI GetFptr(int i)
+extern "C" DLL_EXPORT voidPtr _cdecl GetFptr(int i)
{
return (voidPtr) &CdeclEnum;
}
diff --git a/tests/src/Interop/RefInt/RefIntNative.cpp b/tests/src/Interop/RefInt/RefIntNative.cpp
index 8154cca6ed..5673315859 100755
--- a/tests/src/Interop/RefInt/RefIntNative.cpp
+++ b/tests/src/Interop/RefInt/RefIntNative.cpp
@@ -35,7 +35,7 @@ extern "C" BOOL DLL_EXPORT __stdcall MarshalRefInt_Stdcall(int * pint)
}
typedef BOOL (_cdecl *Cdeclcaller)(int* pint);
-extern "C" BOOL DLL_EXPORT __stdcall DoCallBack_MarshalRefInt_Cdecl(Cdeclcaller caller)
+extern "C" BOOL DLL_EXPORT _cdecl DoCallBack_MarshalRefInt_Cdecl(Cdeclcaller caller)
{
//Check the Input
int itemp = iNative;
@@ -71,7 +71,7 @@ extern "C" BOOL DLL_EXPORT __stdcall DoCallBack_MarshalRefInt_Stdcall(Stdcallca
}
typedef BOOL (_cdecl * DelegatePInvokeCdecl)(int * pint);
-extern "C" DLL_EXPORT DelegatePInvokeCdecl MarshalRefInt_DelegatePInvoke_Cdecl()
+extern "C" DLL_EXPORT DelegatePInvokeCdecl _cdecl MarshalRefInt_DelegatePInvoke_Cdecl()
{
return MarshalRefInt_Cdcel;
}
diff --git a/tests/src/Interop/SimpleStruct/SimpleStructNative.cpp b/tests/src/Interop/SimpleStruct/SimpleStructNative.cpp
index 24517b8f10..5fe82146b8 100644
--- a/tests/src/Interop/SimpleStruct/SimpleStructNative.cpp
+++ b/tests/src/Interop/SimpleStruct/SimpleStructNative.cpp
@@ -26,7 +26,7 @@ typedef struct {
}ExplStruct;
extern "C"
-DLL_EXPORT BOOL WINAPI CdeclSimpleStructByRef(Sstr *p)
+DLL_EXPORT BOOL _cdecl CdeclSimpleStructByRef(Sstr *p)
{
p->a = 100;
p->b=1;
@@ -35,7 +35,7 @@ DLL_EXPORT BOOL WINAPI CdeclSimpleStructByRef(Sstr *p)
}
extern "C"
-DLL_EXPORT BOOL WINAPI CdeclSimpleExplStructByRef(ExplStruct *p)
+DLL_EXPORT BOOL _cdecl CdeclSimpleExplStructByRef(ExplStruct *p)
{
if((p->a != 0) || (p->udata.i != 10))
{
@@ -48,7 +48,7 @@ DLL_EXPORT BOOL WINAPI CdeclSimpleExplStructByRef(ExplStruct *p)
}
extern "C"
-DLL_EXPORT Sstr_simple* WINAPI CdeclSimpleStruct(Sstr_simple p,BOOL *result)
+DLL_EXPORT Sstr_simple* _cdecl CdeclSimpleStruct(Sstr_simple p,BOOL *result)
{
Sstr_simple *pSimpleStruct;
if((p.a !=100) || (p.b != FALSE) || (p.c != 3.142))
@@ -65,7 +65,7 @@ DLL_EXPORT Sstr_simple* WINAPI CdeclSimpleStruct(Sstr_simple p,BOOL *result)
}
extern "C"
-DLL_EXPORT ExplStruct* WINAPI CdeclSimpleExplStruct(ExplStruct p,BOOL *result)
+DLL_EXPORT ExplStruct* _cdecl CdeclSimpleExplStruct(ExplStruct p,BOOL *result)
{
ExplStruct *pExplStruct;
if((p.a !=1) || (p.udata.b != FALSE))
@@ -81,7 +81,7 @@ DLL_EXPORT ExplStruct* WINAPI CdeclSimpleExplStruct(ExplStruct p,BOOL *result)
}
extern "C"
-DLL_EXPORT voidPtr WINAPI GetFptr(int i)
+DLL_EXPORT voidPtr _cdecl GetFptr(int i)
{
switch(i)
{
diff --git a/tests/src/Interop/common/xplatform.h b/tests/src/Interop/common/xplatform.h
index 3e7267fe07..c84ac9b1de 100644
--- a/tests/src/Interop/common/xplatform.h
+++ b/tests/src/Interop/common/xplatform.h
@@ -57,7 +57,7 @@
#define WINAPI __stdcall
#endif
-#ifndef __stdcall
+#ifndef _MSC_VER
#if __i386__
#define __stdcall __attribute__((stdcall))
#define _cdecl __attribute__((cdecl))