rm -fr FreeSWITCH.Managed.dll\r
\r
FreeSWITCH.Managed.dll: AssemblyInfo.cs Extensions.cs Loader.cs Log.cs ManagedSession.cs PluginInterfaces.cs PluginManager.cs ScriptPluginManager.cs swig.cs\r
- gmcs -target:library -out:FreeSWITCH.Managed.dll AssemblyInfo.cs Extensions.cs Loader.cs Log.cs ManagedSession.cs PluginInterfaces.cs PluginManager.cs ScriptPluginManager.cs ChannelVariables.cs swig.cs\r
+ gmcs -target:library -out:FreeSWITCH.Managed.dll AssemblyInfo.cs Extensions.cs Loader.cs Log.cs ManagedSession.cs PluginInterfaces.cs PluginManager.cs ScriptPluginManager.cs ChannelVariables.cs Util.cs swig.cs\r
\r
install: FreeSWITCH.Managed.dll\r
$(INSTALL) FreeSWITCH.Managed.dll $(DESTDIR)$(MODINSTDIR)\r
--- /dev/null
+/* \r
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed\r
+ * Copyright (C) 2008, Michael Giagnocavo <mgg@giagnocavo.net>\r
+ *\r
+ * Version: MPL 1.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Michael Giagnocavo <mgg@giagnocavo.net>\r
+ * Portions created by the Initial Developer are Copyright (C)\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * \r
+ * Michael Giagnocavo <mgg@giagnocavo.net>\r
+ * \r
+ * Util.cs - misc functions\r
+ *\r
+ */\r
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Runtime.InteropServices;\r
+using System.Reflection;\r
+\r
+namespace FreeSWITCH {\r
+ public static class FSUtil {\r
+ // IntPtr cPtr, bool futureUse\r
+ static readonly Type[] swigConstructorTypes = new [] { typeof(IntPtr), typeof(bool) };\r
+ public static T CreateSwigTypePointer<T>(this IntPtr cPtr) {\r
+ var ty = typeof(T);\r
+ var bflags = BindingFlags.Default | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;\r
+ var cons = ty.GetConstructor(bflags, null, swigConstructorTypes, null);\r
+ if (cons == null) throw new ArgumentException(ty.Name + " constructor not found.");\r
+ return (T)cons.Invoke(new object[] { cPtr, false });\r
+ }\r
+ }\r
+}\r