if PLATFORM_WIN32
+# Use -m here. This will use / as directory separator (C:/WINNT).
+# The files that use MONO_ASSEMBLIES and/or MONO_CFG_DIR replace the
+# / by \ if running under WIN32.
+assembliesdir = `cygpath -m "${libdir}"`
+confdir = `cygpath -m "${sysconfdir}"`
export HOST_CC
+else
# The mingw math.h has "extern inline" functions that dont appear in libs, so
# optimisation is required to actually inline them
AM_CFLAGS = -O
+assembliesdir = $(exec_prefix)/lib
+confdir = $(sysconfdir)
endif
PLATFORM_LIB = ../os/libmonoos.la
noinst_LTLIBRARIES = libmonoruntime.la libmonoruntime-static.la
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS)
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS) -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\"
#
# Make sure any prefix changes are updated in the binaries too.
return default_path [0];
}
+/**
+ * mono_set_dirs:
+ * @assembly_dir: the base directory for assemblies
+ * @config_dir: the base directory for configuration files
+ *
+ * This routine is used internally and by developers embedding
+ * the runtime into their own applications. There are a number
+ * of cases to consider: Mono as a system-installed package that
+ * is available on the location preconfigured or Mono in a relocated
+ * location.
+ *
+ * If you are using a system-installed Mono, you can pass NULL
+ * to both parameters. If you are not, you should compute both
+ * directory values and call this routine.
+ *
+ * The values for a given PREFIX are:
+ *
+ * assembly_dir: PREFIX/lib
+ * config_dir: PREFIX/etc
+ *
+ * Notice that embedders that use Mono in a relocated way must
+ * compute the location at runtime, as they will be in control
+ * of where Mono is installed.
+ */
+void
+mono_set_dirs (const char *assembly_dir, const char *config_dir)
+{
+ if (assembly_dir == NULL)
+ assembly_dir = MONO_ASSEMBLIES;
+ if (config_dir == NULL)
+ config_dir = MONO_CFG_DIR;
+ mono_assembly_setrootdir (assembly_dir);
+ mono_set_config_dir (config_dir);
+}
+
/**
* mono_assemblies_init:
*
void mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies);
void mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
+void mono_set_dirs (const char *assembly_dir, const char *config_dir);
G_END_DECLS
#endif
/* Invoked during startup */
void
-mono_internal_set_config_dir (const char *dir)
+mono_set_config_dir (const char *dir)
{
/* If this variable is set, overrides the directory computed */
mono_cfg_dir = g_getenv ("MONO_CFG_DIR");
const char*
mono_get_config_dir (void)
{
+ if (mono_cfg_dir == NULL)
+ mono_set_rootdir ();
+
return mono_cfg_dir;
}
#define __MONO_METADATA_CONFIG_H__
const char* mono_get_config_dir (void);
+void mono_set_config_dir (const char *dir);
void mono_config_parse (const char *filename);
void mono_config_for_assembly (MonoImage *assembly);
#include <unistd.h>
#include <mono/os/util.h>
#include <mono/metadata/assembly.h>
+#include <sys/types.h>
+#include <sys/stat.h>
static char *
compute_base (char *path)
char *p = rindex (path, '/');
if (p == NULL)
return NULL;
+
+ /* Not a well known Mono executable, we are embedded, cant guess the base */
+ if (strcmp (p, "/mono") && strcmp (p, "/monodis") && strcmp (p, "/mint") && strcmp (p, "monodiet"))
+ return NULL;
+
*p = 0;
p = rindex (path, '/');
if (p == NULL)
static void
fallback ()
{
- mono_assembly_setrootdir (MONO_ASSEMBLIES);
- mono_internal_set_config_dir (MONO_CFG_DIR);
+ mono_set_dirs (MONO_ASSEMBLIES, MONO_CFG_DIR);
}
static void
set_dirs (char *exe)
{
char *base;
+ char *config, *lib, *mono;
+ struct stat buf;
/*
* Only /usr prefix is treated specially
if (strncmp (exe, MONO_BINDIR, strlen (MONO_BINDIR)) == 0 || (base = compute_base (exe)) == NULL){
fallback ();
return;
- } else {
- char *config, *lib;
- config = g_build_filename (base, "etc", NULL);
- lib = g_build_filename (base, "lib", NULL);
- mono_assembly_setrootdir (lib);
- mono_internal_set_config_dir (config);
- g_free (config);
- g_free (lib);
}
+
+ config = g_build_filename (base, "etc", NULL);
+ lib = g_build_filename (base, "lib", NULL);
+ mono = g_build_filename (lib, "mono/1.0", NULL);
+ if (stat (mono, &buf) == -1)
+ fallback ();
+ else {
+ mono_set_dirs (lib, config);
+ }
+
+ g_free (config);
+ g_free (lib);
+ g_free (mono);
}
installdir = g_path_get_dirname (bindir);
root = g_build_path (G_DIR_SEPARATOR_S, installdir, "lib", NULL);
- mono_assembly_setrootdir (root);
-
config = g_build_filename (root, "..", "etc", NULL);
- mono_internal_set_config_dir (config);
+ mono_set_dirs (root, config);
g_free (config);
g_free (root);
* if you are planning on using the dllmaps defined on the
* system configuration
*/
+ mono_set_dirs (NULL, NULL);
mono_config_parse (NULL);
/*
* mono_jit_init() creates a domain: each assembly is
return func (hwndParent, hwndChildAfter, classw, window);
}
+int
+SetWindowPos (gpointer hwnd, gpointer hwndInsertAfter, int x, int y, int cx, int cy, uint flags)
+{
+ fprintf (stderr, "SetWindowPos 0x%x 0x%x to [%d,%dx%d,%d] %d\n", hwnd, hwndInsertAfter, x, y, cx, cy, flags);
+ return 1;
+}
+int
+SendMessageA (gpointer hwnd, uint msg, gpointer wparam, gpointer lparam)
+{
+ fprintf (stderr, "SendMessage (%d, 0x%x, 0x%x, 0x%x)\n", hwnd, msg, wparam, lparam);
+}
+
+int
+GetWindowLongA (gpointer hwnd, int a)
+{
+}