WINEDLLPATH and /usr/lib/wine

Michael Ost most at
Mon Jan 25 18:51:33 CST 2010

Ben Klein wrote:
> 2010/1/26 Michael Ost <most at>:
>> Alexandre Julliard wrote:
>> I think it makes more sense to require, as Hin-Tak Leung's patch does, that
>> a user put /usr/lib/wine in WINEDLLPATH if they use WINEDLLPATH. This is how
>> LD_LIBRARY_PATH works for ld and PATH works in bash --- so it's expected
>> behavior.
> Actually, it's not how LD_LIBRARY_PATH works.
> $ LD_LIBRARY_PATH=/path/that/does/not/exist/ /bin/echo Hi there
> Hi there
> It is the way it works for PATH in all shells (not just bash), but
> this is a different matter because your shell environment (often a
> login or profile script) provides a default, sensible value for PATH.
> $ echo $PATH
> /usr/local/bin:/usr/bin:/bin:/usr/games

OK - fair enough.

But, if I read the man page correctly LD_LIBRARY_PATH _prepends_ your 
path before the standard paths. That would do fine for me. WINEDLLPATH 
is appended after /usr/lib/wine.

> WINEDLLPATH should certainly behave more like LD_LIBRARY_PATH than
> PATH, but wine should always follow the same DLL search pattern as
> Windows. How would Windows handle adding a directory to the DLL search
> path? (Is this even possible?)

I'm not getting why Windows DLL searching is relevant here. This is a 
Linux-side issue.

>> Also, from my reading of the code, you jump through some special hoops to
>> deal with running from the build directory which could be more easily solved
>> by putting WINEDLLPATH first.
> How, exactly?

This was a slightly uninformed comment on my part, so I could be totally 
off base here. And the code supporting dll directory lookups is 
complicated. But ... I saw special cases for dealing with the build 
directory, including this comment "/* if no build dir skip all the build 
dir magic cases */" libs/wine/loader.c/first_dll_path. Those suggest to 
me that someone was trying to stick a path in before /usr/lib/wine.

All that said, this isn't at all central to what I would like to do. All 
I want is that WINEDLLPATH comes before /usr/lib/wine.

- mo

PS: Hin-Tak Leung, who got bit by this before me, found that WINEDLLPATH 
broke/changed in November of 2006.

More information about the wine-devel mailing list