]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-2774 --resolve upgrade mono support - MichaelGG
authorJeff Lenk <jeff@jefflenk.com>
Tue, 25 Oct 2011 21:58:38 +0000 (16:58 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Tue, 25 Oct 2011 21:59:04 +0000 (16:59 -0500)
src/mod/languages/mod_managed/Makefile
src/mod/languages/mod_managed/freeswitch.i
src/mod/languages/mod_managed/freeswitch_managed.h
src/mod/languages/mod_managed/freeswitch_wrap.cxx
src/mod/languages/mod_managed/mod_managed.cpp

index 0ac49b44a8083479f28610d171e39d760d005ef8..83869ea9e8d8934aae47def91268c4edc9997a77 100644 (file)
@@ -1,6 +1,6 @@
-LOCAL_INSERT_CFLAGS= /usr/bin/pkg-config mono --cflags\r
-LOCAL_INSERT_LDFLAGS= /usr/bin/pkg-config mono --libs\r
-#MOD_CFLAGS=-D_REENTRANT -pthread -I/opt/mono-1.9/lib/pkgconfig/../../include/mono-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lmono\r
+LOCAL_INSERT_CFLAGS= /usr/bin/pkg-config mono-2 --cflags\r
+LOCAL_INSERT_LDFLAGS= /usr/bin/pkg-config mono-2 --libs\r
+#MOD_CFLAGS=-D_REENTRANT -pthread -I/usr/lib/mono -lmono\r
 BASE=../../../..\r
 VERBOSE=1\r
 include $(BASE)/build/modmake.rules\r
@@ -40,4 +40,4 @@ freeswitch_wrap.cxx:
        rm -f *.cs\r
 \r
 depend_install:\r
-       mkdir -p $(DESTDIR)$(modulesdir)/managed\r
+       mkdir -p $(DESTDIR)$(modulesdir)/managed
\ No newline at end of file
index 49e0e27977e68b7026b484b4a0ba8b15d2f69ac9..c3a4416dd5b529793535fce8e8992fe3fb26abbf 100644 (file)
@@ -10,7 +10,6 @@
 \r
 /* Callback for returning strings to C# without leaking memory */\r
 #ifndef _MANAGED\r
-#include <glib.h>\r
 #include <mono/jit/jit.h>\r
 #include <mono/metadata/environment.h>\r
 #include <mono/metadata/mono-config.h>\r
@@ -216,4 +215,4 @@ char * SWIG_csharp_string_callback(const char * str) {
 %include switch_scheduler.h\r
 %include switch_config.h\r
 %include switch_cpp.h\r
-%include freeswitch_managed.h\r
+%include freeswitch_managed.h
\ No newline at end of file
index 1d0b6a72b17eeb73563f015e4e2be7c6c37135e7..cfe4c034e347ada11323a49ce828eabb967efd47 100644 (file)
@@ -40,7 +40,6 @@ typedef void (*hangupFunction) (void);
 typedef char *(*inputFunction) (void *, switch_input_type_t);
 
 #ifndef _MANAGED
-#include <glib.h>
 #include <mono/jit/jit.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/environment.h>
@@ -73,7 +72,7 @@ extern mod_managed_globals globals;
 #ifdef WIN32
 #define RESULT_FREE(x) CoTaskMemFree(x)
 #else
-#define RESULT_FREE(x) g_free(x)
+#define RESULT_FREE(x) mono_free(x)
 #endif
 
 SWITCH_END_EXTERN_C
@@ -191,4 +190,4 @@ class ManagedSession:public CoreSession {
        hangupFunction hangupDelegate;
 };
 
-#endif
+#endif
\ No newline at end of file
index f24001c611c220bdffdcb4ababb5039eae4c9ac1..1093a2568f97fae5132e35c844fb4547fc4aeb5f 100644 (file)
@@ -259,7 +259,6 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_freeswitch(
 
 /* Callback for returning strings to C# without leaking memory */
 #ifndef _MANAGED
-#include <glib.h>
 #include <mono/jit/jit.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-config.h>
@@ -36907,4 +36906,3 @@ SWIGEXPORT CoreSession * SWIGSTDCALL CSharp_ManagedSessionUpcast(ManagedSession
 #ifdef __cplusplus
 }
 #endif
-
index ec2d8663e353e07ae5d1c69081dc4f37fe43e3ea..dc1f8aa604bf3d0bb53b8acf658ae24b018630b2 100644 (file)
@@ -190,6 +190,7 @@ switch_status_t loadRuntime()
        // So linux can find the .so\r
        char xmlConfig[300];\r
        switch_snprintf(xmlConfig, 300, "<configuration><dllmap dll=\"mod_managed\" target=\"%s%smod_managed.so\"/></configuration>", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR);\r
+       mono_config_parse(NULL);\r
        mono_config_parse_memory(xmlConfig);\r
 #endif\r
 \r
@@ -208,18 +209,13 @@ switch_status_t loadRuntime()
        }\r
 \r
        /* Already loaded? */\r
-       MonoAssemblyName name;\r
-       name.name = MOD_MANAGED_ASM_NAME;\r
-       name.major = MOD_MANAGED_ASM_V1;\r
-       name.minor = MOD_MANAGED_ASM_V2;\r
-       name.revision = MOD_MANAGED_ASM_V3;\r
-       name.build = MOD_MANAGED_ASM_V4;\r
-       name.culture = "";\r
-       name.hash_value = "";\r
-\r
+       MonoAssemblyName *name = mono_assembly_name_new (MOD_MANAGED_ASM_NAME);\r
+       //Note also that it can't be allocated on the stack anymore and you'll need to create and destroy it with the following API:\r
+       //mono_assembly_name_free (name);\r
+       \r
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_assembly_loaded.\n");\r
 \r
-       if (!(globals.mod_mono_asm = mono_assembly_loaded(&name))) {\r
+       if (!(globals.mod_mono_asm = mono_assembly_loaded(name))) {\r
                /* Open the assembly */ \r
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_domain_assembly_open.\n");\r
                globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);\r
@@ -444,4 +440,4 @@ SWITCH_STANDARD_API(managedreload_api_function)
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
-SWITCH_END_EXTERN_C\r
+SWITCH_END_EXTERN_C
\ No newline at end of file