read this instead! simplified gmodule question



At dinner I realized that I had not pared down my question to its bare
essentials.  Hopefully this will take a little less time for people to
digest.

I am simply trying to use gmodule to link in a shared object.  When I
attempt to do so I get:

	Aiee, module == NULL!

	** ERROR **: ./module.so: ELF file's phentsize not the expected
		size aborting...

The module is very simple:

	int foo(void){
		return 1;
	}

I compile it as follows:

	gcc -shared -fpic -DPIC -c module.c -o module.so

And I try to link it in with gmodule using the following program:

#include <glib.h> /* gmodule */
#include <gmodule.h> /* gmodule */
#include <stdio.h> /* printf */

int main(int argc, char *argv[])
{
	GModule *module = NULL;

	if(g_module_supported()){
		module = g_module_open ("./module.so", G_MODULE_BIND_LAZY);
		if(!module){
			fprintf(stderr, "Aiee, module == NULL!\n");
			g_error(g_module_error());
		}
	}
	exit(0);
}

And so the question remains, what does "ELF file's phentsize not the
expected size" mean?  How should I be compiling module.c in order to
make g_module_open() like it?  I can't tell the difference between how
I compile this and how gtk-engines is compiled, and I can't tell the
difference between how g_module_open() is called and how it is called
in gtkthemes.c.  Is there anyone here who can offer some advice?  I
have no idea what phentsize is or how to make it the right size...

-- 
Todd Graham Lewis       tlewis@mindspring.net      (800) 719-4664, x2804

"It's still ludicrous that nobody's ever made a run at us by making UNIX
 a popular platform on PCs.  It's almost too late now."  -- Steve Balmer
"It is too late."   -- Bill Gates             _Newsweek_, 6/23/97, p. 82



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]