[Mono-dev] [PATCH] Make mono_dl_register_library into a fallback

Paolo Molaro lupus at ximian.com
Thu Jul 15 10:50:19 EDT 2010

On 07/13/10 Miguel de Icaza wrote:
> > typedef void* (*MonoDlFallbackLoad) (const char *name, int flags, char **err, void *user_data);
> > typedef void* (*MonoDlFallbackSymbol) (void *handle, const char *name, char **err, void *user_data);
> > typedef void* (*MonoDlFallbackClose) (void *handle, void *user_data);
> > 
> > void mono_dl_register_fallback (MonoDlFallbackLoad load_func, MonoDlFallbackSymbol symbol_func,
> > 		MonoDlFallbackClose close_func, void *user_data);
> > 
> > The old interface could be easily implemented on top of this new one (though we
> > likely could drop it as well).
> This implements the suggested API based on Michael's patch.
> I still kept the mono_dl_register as we are now using in 4 different
> ports and we have a bunch of different tools generating that output as
> well as having pointed third parties to this API.

As I said, if the tables are generated by tools, they could be easily
changed to use the new API. As for other uses: I don't think we should
promote the use of an inefficient API especially since the primary use
would be in embedded systems where startup time and memory usage are
important (the array is unsorted, so the search is linear, it is
memory inefficient since the string pointer array uses more space than
needed and on some systems it causes runtime relocations). Sure, if
we're dealing with 10 entry points it's a non issue, but I know that in
the end this will be used for huge APIs like OpenGL etc (the fact you're
talking about tools generating the data hints that there are going to be
lots of entries).

> Index: mono-dl.c
> ===================================================================
> --- mono-dl.c	(revision 160304)
> +++ mono-dl.c	(working copy)
> +MonoDlMapping *
> +dl_mapping_open (const char *file);
> +
> +void *
> +dl_mapping_symbol (void *handle, const char *symbol);
> +
> +char *
> +dl_mapping_error (void);
> +

These declarations do not belong here and should be removed, the rest
looks fine.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list