Ethereal-dev: Re: [Ethereal-dev] Dynamically loading libxml2

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Tue, 5 Jun 2001 18:43:22 -0700 (PDT)
> Code to dynamically load libxml2.  (xmlstub.h is all of the types defined
> in the real libxml2 header files.

	...

> 	if ((handle = dlopen("libxml2.so", RTLD_LAZY)) == NULL) {
> 		fprintf(stderr, "Unable to dlopen \"libxml2\"\n");
> 		return (-1);
> 	}

Not all platforms on which Ethereal runs have "dlopen()".  (HP-UX and
Windows don't.)

You might want to see whether you can use the GLib gmodule routines
instead, as they hide that particular platform dependency.

Note that this won't work on platforms that don't support dynamic
linking at all, so you'd have to check the HAVE_PLUGINS #define (which
should probably get renamed to HAVE_DYNAMIC_LINKING).

Note also that the names of files containing dynamically-loadable
modules don't end with ".so" on all platforms; see "plugins_scan_dir()"
in "epan/plugins.c" for a sleazy hack to determine the suffix.

How quickly does libxml load the XML files?  Does that significantly
slow down startup time?