This is the mail archive of the cygwin 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]
Other format: [Raw text]

Questions about missing DLLs and program behvior, and symlinks to DLLs (also, a small setup recommendation)

Hello!  I haven't been able to find anything about this in the archives.

I recently decided to replace my old Cygwin installation with a new,
fresh one, so everything should be up-to-date here.  [That's my
recommendation: perhaps a way to make it easier to install fresh; it was
necessary to rename both the old Cywin installation and the location of
the downloaded installation packages to keep setup from finding them.]

The DLL questions are regarding programs compiled within Cygwin: when a
program can't find a DLL, one expects some sort of error message to that
effect, and which would indicate the DLL in question. As my demo below
shows, programs simply exit silently and unceremoniously when that happens.

Second, symlinking to DLLs doesn't enable programs to find them, as is
also shown below.

The question turned up when I compiled ffmpeg within Cygwin and the DLLs
 it produced weren't where ffmpeg.exe expected them to be, and it simply
exited with no visible evidence of why.  Moving the DLLs to where
ffmpeg.exe could see them fixed the problem; however, symlinking to them
(which is how ffmpeg installs itself) rather than copying them did not
work.  I am assuming that programs compiled entirely within the Cygwin
environment, with Cygwin tools and libraries, should know Cygwin
symlinks, and they do, usually, apparently just not when trying to load

Here's a basic test, compiling and running the same sources in Cygwin
and MinGW.  Everything is the same in both cases except that after
renaming the DLL to hide it from footest.exe, running the Mingw version
produces a dialog saying that footest.dll can't be found, while in the
Cygwin case, nothing happens at all; the program simply silently aborts.

Additionally, symlinking footest.dll to footest-save.dll after the
rename doesn't help, as mentioned above.

Anybody know anything about this?

/* footest.h */
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
void do_nothing_particularly_spectacular(void);

/*  Missing DLL test: Cygwin vs. non-Cygwin
    footest-1.c (Main program)
	(Aren't you glad that old joke wasn't about a pterodactyl?)
#include "footest.h"

main(int argc, char **argv)
  printf("footest: You've gotten as far a main(), anyway.\n");
  printf("footest: You've gotten back from the DLL, but you knew that.\n");
/*  Missing DLL test: Cygwin vs. non-Cygwin
    footest-2.c (DLL source)
#include "footest.h"

void do_nothing_particularly_spectacular(void)
  printf("You've found the DLL. Congratulations.\n");

The action under Cygwin (Some lines here are wrapped by Thunderbird.):

$ export PS1="\u@\h (Cygwin) \$ "
rsimard@higgins (Cygwin) $ rm -f footest.exe footest*.dll
rsimard@higgins (Cygwin) $ gcc --version
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

rsimard@higgins (Cygwin) $ gcc -shared -o footest.dll footest-2.c
rsimard@higgins (Cygwin) $ gcc -o footest.exe footest-1.c footest.dll
rsimard@higgins (Cygwin) $ footest ; echo $?
footest: You've gotten as far a main(), anyway.
You've found the DLL. Congratulations.
footest: You've gotten back from the DLL, but you knew that.
rsimard@higgins (Cygwin) $ mv -i footest.dll footest-save.dll
rsimard@higgins (Cygwin) $ footest ; echo $?
rsimard@higgins (Cygwin) $ ln -s footest-save.dll footest.dll
rsimard@higgins (Cygwin) $ footest ; echo $?
rsimard@higgins (Cygwin) $ # Nothing happened in the last two cases to
                           # indicate that the program failed to do
rsimard@higgins (Cygwin) $ # anything because of a missing DLL. Also,
                           # as you can see, symlinking the renamed DLL
                           # to the original name didn't help.
rsimard@higgins (Cygwin) $ exit

Thanks for any help,

Ray Simard

Unsubscribe info:
Problem reports:

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