From 2123b46d6d2ec58db279a0d832341f6d0039b0bb Mon Sep 17 00:00:00 2001
From: Michael Jerris <mike@jerris.com>
Date: Thu, 23 Oct 2008 03:57:16 +0000
Subject: [PATCH] tweak calling conventions.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10124 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/mod/languages/mod_managed/freeswitch_managed.h | 13 +++++++++++--
 src/mod/languages/mod_managed/mod_managed.cpp      |  8 ++++----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/mod/languages/mod_managed/freeswitch_managed.h b/src/mod/languages/mod_managed/freeswitch_managed.h
index 477ca82b0b..31d36ef721 100644
--- a/src/mod/languages/mod_managed/freeswitch_managed.h
+++ b/src/mod/languages/mod_managed/freeswitch_managed.h
@@ -38,8 +38,17 @@ SWITCH_BEGIN_EXTERN_C
 #include <switch.h>
 #include <switch_cpp.h>
 
-typedef void (*hangupFunction)(void);
-typedef char* (*inputFunction)(void*, switch_input_type_t);
+/* calling conventions for Windows */
+#ifndef MANAGED_STDCALL
+#ifdef WIN32
+#   define MANAGED_STDCALL __stdcall
+# else
+#   define MANAGED_STDCALL
+# endif 
+#endif
+
+typedef void (MANAGED_STDCALL *hangupFunction)(void);
+typedef char* (MANAGED_STDCALL *inputFunction)(void*, switch_input_type_t);
 
 
 #ifndef _MANAGED
diff --git a/src/mod/languages/mod_managed/mod_managed.cpp b/src/mod/languages/mod_managed/mod_managed.cpp
index b2ad33c016..7f2d366e53 100644
--- a/src/mod/languages/mod_managed/mod_managed.cpp
+++ b/src/mod/languages/mod_managed/mod_managed.cpp
@@ -68,10 +68,10 @@ SWITCH_STANDARD_API(managed_loadassembly); /* Load assembly */
 mod_managed_globals globals = { 0 };
 
 // Global delegates to call managed functions
-typedef int (*runFunction)(const char *data, void *sessionPtr);
-typedef int (*executeFunction)(const char *cmd, void *stream, void *Event);
-typedef int (*executeBackgroundFunction)(const char* cmd);
-typedef int (*loadAssemblyFunction)(const char* filename);
+typedef int (MANAGED_STDCALL *runFunction)(const char *data, void *sessionPtr);
+typedef int (MANAGED_STDCALL *executeFunction)(const char *cmd, void *stream, void *Event);
+typedef int (MANAGED_STDCALL *executeBackgroundFunction)(const char* cmd);
+typedef int (MANAGED_STDCALL *loadAssemblyFunction)(const char* filename);
 static runFunction runDelegate;
 static executeFunction executeDelegate;
 static executeBackgroundFunction executeBackgroundDelegate;