[ITP] perl-Tk

Yitzchak Scott-Thoennes sthoenna@efn.org
Sun Nov 20 19:23:00 GMT 2005

On Sun, Nov 20, 2005 at 12:34:33AM -0500, Charles Wilson wrote:
> Yitzchak Scott-Thoennes wrote:
> >Hence the suggestion of using the features provided by the
> >alternatives package.  Am I correct in assuming this works even for
> >dynamically loaded dlls?
> > 
> No.  It works for .so's on Linux, because the Linux loader understands 
> symlinks.  Cygwin piggybacks on the Window Runtime Loader, which does 
> NOT understand symlinks (nor shortcuts!).  Because alternatives relies 
> entirely on symlinks, it doesn't work for DLLs on windows.

WJFFM (perhaps you missed the "dynamically"?):

$ cat mydll.c
#include <stdio.h>

void hello(void)
  printf ("Hello World!\n");

$ gcc -Wall -shared -o mydll.dll mydll.c

$ ln -s mydll.dll mydllalternate.dll

$ cat myprog.c
#include <dlfcn.h>

int main(int argc, char **argv)
  void *dlh = dlopen("mydllalternate.dll", RTLD_NOW);
  void (*dls)(void) = dlsym(dlh, "hello");
  return 0;

$ gcc -Wall -o myprog.exe myprog.c

$ ./myprog.exe
Hello World!

More information about the Cygwin-apps mailing list