Calling PE DLLs

Daniel Stodden dns at somacoma.de
Wed Nov 2 03:18:39 CST 2005


hi all.

sorry in case this email will get delivered twice to the list.
i subscribed yesterday an promptly used the wrong mail address
to post. so here i post again.

i'm stuck at the process of loading PE dlls.

like some others before me, i've got a native w32 dll which i
would like to hook into on a linux box. no source code available.
the case is almost identical to

http://www.winehq.com/hypermail/wine-devel/2003/12/index.html#231

though, there's not much application code yet, except a small test
program written by myself, currently only meant to call a single
function on the dll.

so, using winemaker does not seem to spit out anything usable, 
and there seems to be no official documentation on how to use 
winebuild here.

the program is called test.c, calling symbols from a vendor-supplied
header file.
created test.o through winegcc:

winegcc -Wall -O2  -I.  -c -o test.o test.c

let's call the library vendor.dll again.
i've played with winedump, finally got a vendor.dll.spec. 

i'm calling winebuild to get a .def as follows:

winebuild --def -E vendor.dll.spec -o libvendor.def

then, one of my better guesses on how to proceed seemed to be:

winebuild --dll -fPIC -E vendor.dll.spec -L. -lvendor test.o -o
libvendor.dll.s

the assembler code looks reasonable. though, linking fails with
duplicate symbols:

winegcc   test.o libvendor.dll.o  -o test
[..]
: multiple definition of `__wine_spec_nt_header'

: multiple definition of `__wine_spec_file_name'


i'm aware that i could probably avoid all of this by just using
LoadLibrary() and resolving the symbols at runtime. otoh, the approach
above is potentially simpler, if i just knew how. :)

could someone please enlighten me? what am i doing wrong? 

thanks,
daniel

-- 
Daniel Stodden
LRR     -      Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München             D-85748 Garching
http://www.lrr.in.tum.de/~stodden         mailto:stodden at cs.tum.edu
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20051102/afcac435/attachment.pgp


More information about the wine-devel mailing list