This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: DLL naming conventions





> Not necessarily, if the PATH settings (or insuring that all dll's and
> exe's go into the same directory) are sufficient to prevent problems.  I
> don't think so, personally.  As distasteful and painful as renaming all
> the dll's is, it *may*, repeat *may*, be the best option.  I believe
> Chris is proactively doing some research; it is possible that we can do
> something else, and avoid the 'cyg' prefix -- like using the 'AppPath'
> registry or something.
> 
> It's just that there is an ingrained desire to stay as unix-like as
> possible -- and that means, libraries start with 'lib', not 'cyg'.  If
> AppPath can fix the problem, then I'd prefer that cygwin's install.exe
> set the appropriate registry entry whenever installing an executable.
> This won't catch *everything*, but dagnabbit, I'm tired of packages
> installing themselves with cp (which break on cygwin thanks to the .exe
> suffix).  They oughta use install.

Here's the search order for DLL's when an AppPath key is set for the
executable in the registry:

1.The directories listed in the App Path registry key 

2.The directory where the executable module for the current process is
located. 

3.The current directory. 

4.The Windows system directory. The GetSystemDirectory function
retrieves the path of this directory. 

5.The Windows directory. The GetWindowsDirectory function retrieves the
path of this directory. 

6.The directories listed in the PATH environment variable.


See http://codeguru.earthweb.com/dll/AppPath.shtml

So, if all .exe's are installed using 'install.exe', and install.exe is
made smart enough to create an AppPath key for each one -- the problem
is solved!

(sotto voce: ermmm...three minor problems:

1. The AppPath entry must be in windows-format:
C:\cygwin\bin;C:\cygwin\usr\local\bin  NOT /bin:/usr/local/bin.  What
happens when you reinstall cygwin to a different location -- say
D:\cygwin -- and change the mount points?

2. The AppPath entry is keyed by the program name:

HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\foo.exe
  default value is string   = "C:\cygwin\usr\local\bin\foo.exe"
  string value named "Path" = "C:\cygwin\bin;C:\cygwin\usr\local\bin"

What if you have two foo.exe's -- one cygwin, and one mingw ?

3. It doesn't work if there is already a dll with the same name, loaded
into memory (for Win95, Win98, and WinNT; the following analysis doesn't
apply to Win98SE or W2K)

e.g. 
  c:\cygwin\usr\local\bin\app1.exe
    (app1.exe has AppPath key so that c:\cygwin\usr\bin is searched
first)
  c:\cygwin\usr\bin\my-dll.dll

  c:\mingw\usr\local\bin\app2.exe
    (app2.exe has AppPath key so that c:\mingw\usr\bin is searched
first)
  c:\mingw\usr\bin\my-dll.dll

Run app1.exe -- fine, c:\cygwin\usr\bin\my-dll.dll gets loaded.
Run app2.exe -- *will not load* c:\mingw\usr\bin\my-dll.dll into memory.

This analysis extrapolated from description in:
http://codeguru.earthweb.com/mfc/comments/6493.shtml

Maybe the problem isn't solved by AppPath, after all.

--Chuck

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]