Skip to content

Instantly share code, notes, and snippets.

@niner
Last active November 26, 2017 19:24
Show Gist options
  • Save niner/9cf08c0f83a02bc6860c1313ab383ef0 to your computer and use it in GitHub Desktop.
Save niner/9cf08c0f83a02bc6860c1313ab383ef0 to your computer and use it in GitHub Desktop.
diff --git a/src/core/nativecall_dyncall.c b/src/core/nativecall_dyncall.c
index 80616e333..5edaf7d7e 100644
--- a/src/core/nativecall_dyncall.c
+++ b/src/core/nativecall_dyncall.c
@@ -6,6 +6,11 @@
/* Maps a calling convention name to an ID. */
MVMint16 MVM_nativecall_get_calling_convention(MVMThreadContext *tc, MVMString *name) {
MVMint16 result = DC_CALL_C_DEFAULT;
+#ifdef _WIN64
+ result = DC_CALL_C_X64_WIN64;
+#elif defined(__x86_64__)
+ result = DC_CALL_C_X64_SYSV;
+#else
if (name && MVM_string_graphs(tc, name) > 0) {
char *cname = MVM_string_utf8_encode_C_string(tc, name);
if (strcmp(cname, "cdecl") == 0)
@@ -16,8 +21,6 @@ MVMint16 MVM_nativecall_get_calling_convention(MVMThreadContext *tc, MVMString *
result = DC_CALL_C_X86_WIN32_THIS_GNU;
else if (strcmp(cname, "thisms") == 0)
result = DC_CALL_C_X86_WIN32_THIS_MS;
- else if (strcmp(cname, "stdcall") == 0)
- result = DC_CALL_C_X64_WIN64;
else {
char *waste[] = { cname, NULL };
MVM_exception_throw_adhoc_free(tc, waste,
@@ -25,6 +28,7 @@ MVMint16 MVM_nativecall_get_calling_convention(MVMThreadContext *tc, MVMString *
}
MVM_free(cname);
}
+#endif
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment