Calling PE DLLs

Daniel Stodden stodden at cs.tum.edu
Tue Nov 1 18:50:27 CST 2005


hi all.

i'm stuck.

like probably many 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, winemaker doesn't 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
libmxmapi32.dll.s

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

winegcc   test.o libmxmapi32.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




More information about the wine-devel mailing list