Need help compiling glib's libgmodule DLL (gmodule-dl.c)

Kevin Wright
Sat Jan 20 12:26:00 GMT 2001


For quite a while now, I've been trying to run gnome under cygwin.
This requires getting libgmodule to compile as a DLL (gmodule is
part of glib). I thought we had a breakthrough when "Edward ?"
posted the following last December 6th:
( )

edward> gmodule works for me.
edward> ugh. with spelling errors and all from the cvs source :)
edward> um. i did have to patch gmodule-dl.c and testgmodule.c
edward> um. and gdate.c and gmarkup.c and gstrfuncs.c
edward> and I did have to make tons of changes to the automake/libtool
edward> files to get the dll to build correctly.

I've tried to reproduce this with no luck and my emails to Edward
have gone unanswered. I patched to the cvs source with Edward's patch
but he also made many changes to the libtool and automake which
allowed him to create the DLL's which he didn't post.

I'm trying to do this by hand with some success.

Here's what I did to create the dll:

1) dlltool --export-all --output-def libgmodule_.def --dllname \
   libgmodule-1.3.dll gmodule.o

2) gcc -shared -Wl,--enable-auto-image-base -o libgmodule-1.3.dll \
   -Wl,--out-implib=libgmodule-1.3.a libgmodule_.def *.o -L../libs \

Here's the error I get when I run testgmodule:

/usr/local/src/glib/gmodule/ ./testgmodule.exe
testgmodule (/usr/local/src/glib/gmodule):
get main module handle
check that not yet bound symbols in shared libraries of main module are
retrive symbol `g_module_close' from "main":
error: `g_module_close': dlsym: Win32 error 127

Here's the output of cygcheck testgmodule.exe:

So, if anyone has managed to do this, (create DLL's via automake and
libtool without having to create them by hand) I'd like to know how.
Also, I'd like to know whether I'm creating the DLL's properly. It's
possible that the problem is with the testgmodule program. It's
been updated in the cvs source since Edward posted his patch.

NOTE: I just found one of the problems I'm having is that the makefile
compiles gmodule.c instead of gmodule-dl.c (one of the files Edward
supplied a patch for) I assume this is the reason for my error. However,
when I try to compile gmodule-dl.c, I get tons of errors:

/usr/local/src/glib/gmodule/ make gmodule-dl
gcc -g -O2 -Wall -D_REENTRANT    gmodule-dl.c   -o gmodule-dl
gmodule-dl.c:75: parse error before `find_in_any_module_using_toolhelp'
gmodule-dl.c:75: warning: type defaults to `int' in declaration of `gchar'
gmodule-dl.c:75: parse error before `*'
gmodule-dl.c:76: warning: return-type defaults to `int'
gmodule-dl.c: In function `find_in_any_module_using_toolhelp':
gmodule-dl.c:91: `gpointer' undeclared (first use in this function)
gmodule-dl.c:91: (Each undeclared identifier is reported only once
gmodule-dl.c:91: for each function it appears in.)
gmodule-dl.c:91: parse error before `p'
gmodule-dl.c:97: warning: return makes integer from pointer without a cast
gmodule-dl.c:104: warning: return makes integer from pointer without a cast
gmodule-dl.c:108: warning: return makes integer from pointer without a cast
gmodule-dl.c:111: `p' undeclared (first use in this function)
gmodule-dl.c:115: `symbol_name' undeclared (first use in this function)
gmodule-dl.c:123: warning: control reaches end of non-void function
[more errors/warnings deleted]

I assume that this means that either I've patched the file incorrectly or
am missing something else. Again, if anyone has managed to make this work,
please post how you accomplished this. I'm sure you would make a lot of
people very happy. (myself included)


--Kevin Wright

Want to unsubscribe from this list?
Check out:

More information about the Cygwin mailing list