summaryrefslogtreecommitdiff
path: root/include/git2/common.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-01-09 12:33:47 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2019-01-17 21:17:32 +0000
commita74dd39b232ae8c54517446089316b9643b3a84a (patch)
treeb4d6a15a17f6a45570a804331cba34eab5d7994b /include/git2/common.h
parentb78bcbb9b1217d6aada0ab98f3053cb8f151a8a3 (diff)
downloadlibgit2-a74dd39b232ae8c54517446089316b9643b3a84a.tar.gz
Use cdecl calling conventions on Win32
The recommendation from engineers within Microsoft is that libraries should have a calling convention specified in the public API, and that calling convention should be cdecl unless there are strong reasons to use a different calling convention. We previously offered end-users the choice between cdecl and stdcall calling conventions. We did this for presumed wider compatibility: most Windows applications will use cdecl, but C# and PInvoke default to stdcall for WINAPI compatibility. (On Windows, the standard library functions are are stdcall so PInvoke also defaults to stdcall.) However, C# and PInvoke can easily call cdecl APIs by specifying an annotation. Thus, we will explicitly declare ourselves cdecl and remove the option to build as stdcall.
Diffstat (limited to 'include/git2/common.h')
-rw-r--r--include/git2/common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index 82f6ba48b..b97f9ef8a 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -43,7 +43,7 @@ typedef size_t size_t;
__attribute__((visibility("default"))) \
type
#elif defined(_MSC_VER)
-# define GIT_EXTERN(type) __declspec(dllexport) type
+# define GIT_EXTERN(type) __declspec(dllexport) type __cdecl
#else
# define GIT_EXTERN(type) extern type
#endif