Hi,
I am currently having trouble building the DLLs of an application ported
from Win32 to Winelib - compiling, thanks to some hints from Dimi O.
Paun, now works fine, only(?) the final linking step fails. Since
Winelib-documentation is unfortunately pretty outdated, I tried to
orientate myself on the makefiles of the Winelib dlls in the cvs
/wine/dlls/ directory. I tried the following build-steps:
1. Build all object files with winegcc/wineg++ and the following
flags:> -W -g -O0 -I/ -I/usr/include/wine -D_DEBUG -DWIN32 -D_WINDOWS
> -DNOARRAYMACROS -DBUILD_DLL -fPIC
2. relocate symbols (took this one from the makefile of
advapi32.dll):> ld -r $(OBJS) -o libdll.tmp.so && strip --strip-unneeded
libdll.tmp.so
3. build spec file with the previously generated temporary library, the
imported libraries from winelib and with a spec-file containing the
functions to be exported from the dll and compile it (omitted here)
with the same flags as used above for the original source
files:> winebuild -fPIC -L/usr/local/lib/wine -lntdll -lkernel32 -luser32
> -lgdi32-lcomdlg32 -lcrtdll -o libdll.spec.c --spec libdll.spec
> libdll.temp.o
Finally, I (at least try to) tie everything together in a single
library:
> winegcc -shared -Wl,-soname,libdll.so -DSTRICT -D_REENTRANT
> -L/usr/local/lib/wine -lntdll -lkernel32 -luser32 -lgdi32 -lcomdlg32
> -lstdc++ -lcrtdll -lgcc_s -lm $(OBJS)
The result is the following warnings and errors:
> (1) libdll.spec.o(.rodata+0x0): multiple definition of `dllname'
> /tmp/wappX6tcsm.spec.o(.rodata+0x0): first defined here
> (2) /usr/bin/ld: Warning: size of symbol `dllname' changed from 10 in
> /tmp/wappX6tcsm.spec.o to 12 in
> (3) /tmp/wappX6tcsm.spec.o(.text+0x1004a): In function
> `__wine_exe_main':: undefined reference to `main'
Regarding (1) and (2): I cannot make a sense on why I should have made a
mistake here - it seems as if we have two spec-files here, one generated
by myself, and one automatically (the one in /tmp/wapp*.spec.o). Why's
this happening? And why are we coping with a __wine_exe_main in (3)? I
am trying to build a dll, so something's going totally wrong here...
Thinking about problems with the spec-file, I replaced my self-written
file with functions to be exported with an entirely empty one. However,
the errors stay the same.
Furthermore, I thought I had to use --entry as an option to specify my
special entry point (do I still have to change it from dllmain on Win32
to a unique name for Linux/Unix to avoid duplicate names in libraries,
or does winebuild handle this somehow?). Using or not using it does not
make any difference...
You see, I am a little bit desperate about this thing, having come
pretty far, but now seeming to fail on the last meters. So any help (on
this list or if you think it's too specific to my private mail) would be
really, really appreciated. If I find some time, I will volunteer to
write a short step-by-step guide based on my observations, if this is
any help for you to avoid dumb questions like these ;-)
Thanks a lot,
Cheers,
Martin--