Building XFCE on Cygwin

Brian J. Tarricone bjt23 at cornell.edu
Fri Jul 9 18:20:18 CEST 2004


On Fri, 9 Jul 2004, Maarten Boekhold wrote:

> According to the cygwin list there are two ways of handling libraries 
> that refer to symbols defined inside executables: (1) extract all the 
> 'exported' functions from those executables and put them in a separate 
> shared library, and (2) create stub libraries for those exported symbols.
> 
> I suspect that the XFCE developers would be less than enthousiastic 
> about option 1, as it seems fairly invasive to me. But 2 should be 
> possible. I still haven't figured out the details of how to do (2) yet, 
> but I'm working on it.

*sigh* i was afraid of that.  here's my guess as to how to do it (i'll 
use an example):

say we have a function in xfce4-panel:

gint xfce_panel_get_cool_int();

we create a .c file to hold our stub library, and put in it something 
like this:

gint
xfce_panel_get_cool_int()
{
	GModule *gm;
	gint (*the_real_get_cool_int)() = NULL;

	gm = g_module_open("/path/to/xfce4-panel", 0);
	if(gm && g_module_symbol(gm, "xfce_panel_get_cool_int",
		(gpointer)&the_real_get_cool_int))
	{
		gint the_int = the_real_get_cool_int();
		g_module_close(gm);
		return the_int;
	} else {
		g_error("can't find symbol....");
		abort();
	}
}

at least i _think_ that will work.  you might have to do use actual 
win32 calls, but my guess is that the GModule interface should work.  
unfortunately, there will probably be some extra hoops to jump through 
to get at non-function symbols (i.e., variables) that we access (mainly 
for the panel).  in that case, this stub library would have to have an 
some exported global vars of the same names, and an init function to do 
the g_module_open() and g_module_symbol() to set them up.  not sure how 
feasible that is, as that means that each plugin will have to call the 
init function, but _only_ if we're in a cygwin environment.  this is 
doable for our plugins, but third-party plugins will need to be modified 
as well.

of course, it's olivier's call whether or not he minds all this 
conditionally-compiled stub stuff in our build trees.

	-brian




More information about the Xfce4-dev mailing list