[Mono-dev] Mono-INFO: DllImport loading location: 'libc.so.6.so'.

Lionel Tricon lionel.tricon at free.fr
Wed Apr 9 14:47:24 EDT 2008


Hi,

i Work for the klik(2) project and during our tests to support mono, we found 
that a '.so' suffix is added to each library before trying to load them. Mono 
works but is very slow on starting.

Mono-INFO: DllImport attempting to load: 'libc.so.6'.
Mono-INFO: DllImport loading location: 'libc.so.6.so'.
Mono-INFO: DllImport error loading library: 'libc.so.6.so: Ne peut ouvrir le 
fichier d'objet partagé: Aucun fichier ou répertoire de ce type'.
Mono-INFO: DllImport loading library: './libc.so.6.so'.
Mono-INFO: DllImport error loading library './libc.so.6.so

I put a glance into the mono source version 1.2.4 and isolated the part of 
code which contains both warning messages (file mono/metadata/loader.c) :

 mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
 "DllImport attempting to load: '%s'.", new_scope);
...
 if (!module) {
 void *iter = NULL;
 while ((full_name = mono_dl_build_path (NULL,file_name, &iter))) {
 mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
 "DllImport loading location: '%s'.", full_name);

For me, only mono_dl_build_path() is able to add the '.so' suffix.

If you review this function (file mono/utils/mono-dl.c), it's clear that mono 
add '.so' at the end of the file name :

char*
mono_dl_build_path (const char *directory, const char *name, void **iter)
{
....
        if (directory && *directory)
                res = g_strconcat (directory, G_DIR_SEPARATOR_S, prefix, name, 
suffixes [idx], NULL);
        else
                res = g_strconcat (prefix, name, suffixes [idx], NULL);
}

directory=NULL and iter=NULL when this function is called, so we automaticaly 
add suffixes[idx] to the name parameter. And since idx=0 and 
suffixes[0]='.so' .....

For me, the source code should be :

if (directory && *directory)
                res = g_strconcat (directory, G_DIR_SEPARATOR_S, prefix, name, 
suffix, NULL);
        else
                res = g_strconcat (prefix, name, suffix, NULL);

As it's said : "if the platform prefix is already provided, we suppose the 
caller knows the full name already".

Suffix is correctly declared but not used at all after.

Best regards,
Lionel Tricon


More information about the Mono-devel-list mailing list