FS-2774 --resolve upgrade mono support - MichaelGG

This commit is contained in:
Jeff Lenk 2011-10-25 16:58:38 -05:00
parent cdb00f132b
commit 1dcac642dd
5 changed files with 14 additions and 22 deletions

View File

@ -1,6 +1,6 @@
LOCAL_INSERT_CFLAGS= /usr/bin/pkg-config mono --cflags
LOCAL_INSERT_LDFLAGS= /usr/bin/pkg-config mono --libs
#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
LOCAL_INSERT_CFLAGS= /usr/bin/pkg-config mono-2 --cflags
LOCAL_INSERT_LDFLAGS= /usr/bin/pkg-config mono-2 --libs
#MOD_CFLAGS=-D_REENTRANT -pthread -I/usr/lib/mono -lmono
BASE=../../../..
VERBOSE=1
include $(BASE)/build/modmake.rules
@ -40,4 +40,4 @@ freeswitch_wrap.cxx:
rm -f *.cs
depend_install:
mkdir -p $(DESTDIR)$(modulesdir)/managed
mkdir -p $(DESTDIR)$(modulesdir)/managed

View File

@ -10,7 +10,6 @@
/* 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>
@ -216,4 +215,4 @@ char * SWIG_csharp_string_callback(const char * str) {
%include switch_scheduler.h
%include switch_config.h
%include switch_cpp.h
%include freeswitch_managed.h
%include freeswitch_managed.h

View 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

View 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

View File

@ -190,6 +190,7 @@ switch_status_t loadRuntime()
// So linux can find the .so
char xmlConfig[300];
switch_snprintf(xmlConfig, 300, "<configuration><dllmap dll=\"mod_managed\" target=\"%s%smod_managed.so\"/></configuration>", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR);
mono_config_parse(NULL);
mono_config_parse_memory(xmlConfig);
#endif
@ -208,18 +209,13 @@ switch_status_t loadRuntime()
}
/* Already loaded? */
MonoAssemblyName name;
name.name = MOD_MANAGED_ASM_NAME;
name.major = MOD_MANAGED_ASM_V1;
name.minor = MOD_MANAGED_ASM_V2;
name.revision = MOD_MANAGED_ASM_V3;
name.build = MOD_MANAGED_ASM_V4;
name.culture = "";
name.hash_value = "";
MonoAssemblyName *name = mono_assembly_name_new (MOD_MANAGED_ASM_NAME);
//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:
//mono_assembly_name_free (name);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_assembly_loaded.\n");
if (!(globals.mod_mono_asm = mono_assembly_loaded(&name))) {
if (!(globals.mod_mono_asm = mono_assembly_loaded(name))) {
/* Open the assembly */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_domain_assembly_open.\n");
globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
@ -444,4 +440,4 @@ SWITCH_STANDARD_API(managedreload_api_function)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_END_EXTERN_C
SWITCH_END_EXTERN_C