mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-13 14:54:17 +00:00
cdecl'd calling conventions
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10125 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
2123b46d6d
commit
97157c42fc
4 files changed
+17
-19
No files matched your search
@@ -94,16 +94,20 @@ namespace FreeSWITCH
|
||||
}
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate bool ExecuteDelegate(string cmd, IntPtr streamH, IntPtr eventH);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate bool ExecuteBackgroundDelegate(string cmd);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate bool RunDelegate(string cmd, IntPtr session);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate bool LoadAssemblyDelegate(string filename);
|
||||
static readonly ExecuteDelegate _execute = Execute;
|
||||
static readonly ExecuteBackgroundDelegate _executeBackground = ExecuteBackground;
|
||||
static readonly RunDelegate _run = Run;
|
||||
static readonly LoadAssemblyDelegate _loadAssembly = LoadAssembly;
|
||||
//SWITCH_MOD_DECLARE(void) InitManagedDelegates(runFunction run, executeFunction execute, executeBackgroundFunction executeBackground, loadAssemblyFunction loadAssembly)
|
||||
[DllImport("mod_managed", CharSet = CharSet.Ansi)]
|
||||
[DllImport("mod_managed", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void InitManagedDelegates(RunDelegate run, ExecuteDelegate execute, ExecuteBackgroundDelegate executeBackground, LoadAssemblyDelegate loadAssembly);
|
||||
|
||||
// Be rather lenient in finding the Load and Unload methods
|
||||
|
||||
@@ -38,12 +38,15 @@ namespace FreeSWITCH.Native
|
||||
{
|
||||
// switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type_t itype)
|
||||
// But, process_callback_result is used to turn a string into a switch_status_t
|
||||
//using DtmfCallback = Func<IntPtr, Native.switch_input_type_t, string>;
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate string DtmfCallback(IntPtr input, Native.switch_input_type_t itype);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate void CdeclAction();
|
||||
|
||||
public partial class ManagedSession
|
||||
{
|
||||
// SWITCH_DECLARE(void) InitManagedSession(ManagedSession *session, MonoObject *dtmfDelegate, MonoObject *hangupDelegate)
|
||||
[DllImport("mod_managed.dll", CharSet = CharSet.Ansi)]
|
||||
[DllImport("mod_managed.dll", CharSet = CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void InitManagedSession(IntPtr sessionPtr, DtmfCallback dtmfDelegate, Action hangupDelegate);
|
||||
|
||||
/// <summary>Initializes the native ManagedSession. Must be called after Originate.</summary>
|
||||
|
||||
Reference in new issue
Block a user