fix mod_mono build. still needs some testing

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5084 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-05-04 01:25:29 +00:00
parent 55cf8326db
commit dd45f3d599
2 changed files with 8 additions and 24 deletions

View File

@ -8,7 +8,7 @@ GETTEXT_DIR = $(switch_srcdir)/libs/$(GETTEXT)
PKGCONFIG = pkg-config-0.21
PKGCONFIG_DIR = $(switch_srcdir)/libs/$(PKGCONFIG)
LOCAL_CFLAGS=`$(PREFIX)/bin/pkg-config --cflags mono`
LOCAL_CFLAGS=-w `$(PREFIX)/bin/pkg-config --cflags mono`
LOCAL_LDFLAGS=`$(PREFIX)/bin/pkg-config --libs mono`
include ../../../../build/modmake.rules

View File

@ -96,12 +96,10 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
char *assembly_dir = (char *) switch_core_alloc(mono_pool, assembly_dir_len);
char *assembly_file = (char *) switch_core_alloc(mono_pool, assembly_file_len);
apr_finfo_t *assembly_finfo = (apr_finfo_t *) switch_core_alloc(mono_pool, sizeof(*assembly_finfo));
snprintf(assembly_dir, assembly_dir_len, "%s/%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR);
snprintf(assembly_file, assembly_file_len, "%s/%s%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR, SWITCH_MONO_ASSEMBLY);
if (apr_stat(assembly_finfo, assembly_file, 0, mono_pool) != SWITCH_STATUS_SUCCESS) {
if (switch_file_exists(assembly_file, mono_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not find FreeSwitch.NET assembly\n");
return SWITCH_STATUS_FALSE;
}
@ -143,7 +141,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
for (p = switch_hash_first(mono_pool, globals.plugins); p; p = switch_hash_next(p)) {
mono_plugin *plugin = (mono_plugin *) switch_core_alloc(mono_pool, sizeof(*plugin));
apr_ssize_t *key_length = NULL;
switch_ssize_t *key_length = NULL;
const void *key = NULL;
void *value = NULL;
@ -177,19 +175,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
*/
switch_status_t mod_mono_load_modules(const char *module_dir)
{
apr_finfo_t *module_finfo = (apr_finfo_t *) switch_core_alloc(mono_pool, sizeof(*module_finfo));
if (apr_stat(module_finfo, module_dir, 0, mono_pool) != SWITCH_STATUS_SUCCESS) {
if (switch_file_exists(module_dir, mono_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not access module dir!.\n");
return SWITCH_STATUS_FALSE;
}
apr_dir_t *module_dir_handle;
switch_dir_t *module_dir_handle;
char *file;
size_t len;
char *ptr;
apr_finfo_t finfo;
apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
const char *ext = ".dll";
const char *EXT = ".DLL";
MonoAssembly *assembly;
@ -197,24 +190,15 @@ switch_status_t mod_mono_load_modules(const char *module_dir)
gpointer iter;
iter = NULL;
mono_plugin *plugin = NULL;
const char *fname = NULL;
if (apr_dir_open(&module_dir_handle, module_dir, mono_pool) != SWITCH_STATUS_SUCCESS)
if (switch_dir_open(&module_dir_handle, module_dir, mono_pool) != SWITCH_STATUS_SUCCESS)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open directory: %s\n", module_dir);
/* Read the modules directory */
while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == SWITCH_STATUS_SUCCESS) {
while ((fname = switch_dir_next_file(module_dir_handle))) {
assembly = (MonoAssembly *) switch_core_alloc(mono_pool, sizeof(assembly));
image = (MonoImage *) switch_core_alloc(mono_pool, sizeof(image));
const char *fname = finfo.fname;
if (finfo.filetype != APR_REG)
continue;
if (!fname)
fname = finfo.name;
if (!(ptr = (char *) fname))
continue;
if (!strstr(fname, ext) && !strstr(fname, EXT))
continue;