Discussion:
Linking a winelib application with a windows dll
Thomas Trummer
2009-08-22 13:15:22 UTC
Permalink
Hi,

I have a windows dll without source code (vendor.dll) that I want to use in
a winelib application.

There are two problems however:

1) Creating a vendor.def file doesn't work. The resulting file has an empty
EXPORTS section:

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


2) According to an older mailing post it should be possbile to use the .def
file to link:

winegcc -o test test.o -lvendor

However, this fails:

/usr/bin/ld: cannot find -lvendor
collect2: ld returned 1 exit status
winegcc: i486-linux-gnu-gcc failed


Thomas
Thomas Trummer
2009-08-22 13:22:48 UTC
Permalink
Hi,

OK, a minute after I sent the mail I figured out number two:

For vendor.dll the corresponding .def file has to be called libvendor.def.

I still need help with point one, though.


Thomas
André Hentschel
2009-08-22 15:09:38 UTC
Permalink
Post by Thomas Trummer
Hi,
I have a windows dll without source code (vendor.dll) that I want to use
in a winelib application.
1) Creating a vendor.def file doesn't work. The resulting file has an
winedump spec vendor.dll
winebuild --def -E vendor.spec -o vendor.def
2) According to an older mailing post it should be possbile to use the
winegcc -o test test.o -lvendor
/usr/bin/ld: cannot find -lvendor
collect2: ld returned 1 exit status
winegcc: i486-linux-gnu-gcc failed
Thomas
------------------------------------------------------------------------
Hi Thomas,
You need the Headerfile for your dll. If you got it and put it in the same Folder you can run:
winedump spec -I . vendor.dll
-I specifies the path where to search for function prototypes, so the spec-file doesnt include only stubs.
Stubs are ignored when generating a def file.
Of course you also can rewrite the stubs into stdcalls by yourself, but i bet you wont.
--
Best Regards, André Hentschel
Juan Lang
2009-08-22 15:17:02 UTC
Permalink
Post by Thomas Trummer
I have a windows dll without source code (vendor.dll) that I want to use in
a winelib application.
1) Creating a vendor.def file doesn't work. The resulting file has an empty
winedump spec vendor.dll
winebuild --def -E vendor.spec -o vendor.def
That seems to mean winedump isn't parsing this right, or that it truly
has no exports. You want to debug winedump, perhaps by adding the -v
flag to winedump.
--Juan
Steven Edwards
2009-08-23 18:18:32 UTC
Permalink
Post by Juan Lang
Post by Thomas Trummer
1) Creating a vendor.def file doesn't work. The resulting file has an empty
winedump spec vendor.dll
winebuild --def -E vendor.spec -o vendor.def
That seems to mean winedump isn't parsing this right, or that it truly
has no exports.  You want to debug winedump, perhaps by adding the -v
flag to winedump.
You can use something like dependancy walker to verify the function
names that it exports.
--
Steven Edwards

"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo
Thomas Trummer
2009-08-23 19:08:20 UTC
Permalink
Hi,

The Dll exports its function names using the __stdcall decorations e.g.
***@0. Windows OS Dlls also provide an undecorated name
(GetLibraryVersion) which winedump expects. While it would be easy to fix
winedump I'm not sure this would suffice. Especially I don't know if it's
actually possible to call decorated Dll functions from a winelib
application.

Therefore I'm going to use LoadLibrary et.al. which is a bit tiresome with
300 exported functions but at least is guaranteed to work.

Thomas

Loading...