This is the mail archive of the cygwin-developers 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]

Re: RFC: Cygwin 64 bit?


On Fri, 2011-07-08 at 08:51 +0200, Corinna Vinschen wrote:
> (*) Actually, come to think of it, I never really *tried* if that
>     problem actually exists.
> 
>     Setup: Create a Mingw 32 and 64 bit DLL using the same name
>     like libfoo.dll with an entry point foo.  Store the 64 bit
>     DLL somewhere in $PATH, keep the 32 bit DLL in $CWD.  Create
>     a 64 bit application calling foo().  Run the application.
>     Does it work or does it go boom?  Same test for an application
>     loading libfoo at runtime via LoadLibrary.
> 
>     Without actually knowing what happens, we're practically just
>     speculating.  That's probably not the way to solve the problem.
> 
>     Yaakov, would you mind to do such a test and report back?

Here we go:

$ cd ~/tmp

$ mingw32=/usr/i686-pc-mingw32/sys-root/mingw/bin
$ mingw64=/usr/x86_64-w64-mingw32/sys-root/mingw/bin

$ ls $mingw32/*gpg-error*
/usr/i686-pc-mingw32/sys-root/mingw/bin/gpg-error-config*
/usr/i686-pc-mingw32/sys-root/mingw/bin/gpg-error.exe*
/usr/i686-pc-mingw32/sys-root/mingw/bin/libgpg-error-0.dll*

$ ls $mingw64/*gpg-error*
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/gpg-error-config*
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/gpg-error.exe*
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgpg-error-0.dll*

$ cp $mingw32/gpg-error.exe gpg-error-32.exe
$ cp $mingw64/gpg-error.exe gpg-error-64.exe

$ PATH=$mingw32:$mingw64:$PATH ./gpg-error-64 3
(works)

$ PATH=$mingw64:$mingw32:$PATH ./gpg-error-32 3
(works)

$ cat > gpg-error-dl.c <<_EOF
#include <windows.h>
#include <stdio.h>

int
main (void)
{
  const char *(*gpg_strerror) (unsigned int);

  HMODULE hDll = LoadLibrary ("libgpg-error-0.dll");
  if (!hDll)
    return 1;
  gpg_strerror = GetProcAddress (hDll, "gpg_strerror");
  if (!gpg_strerror)
    return 2;
  printf ("%s\n", (*gpg_strerror) (3));
  return 0;
}
_EOF

$ i686-pc-mingw32-gcc -o gpg-error-dl.exe gpg-error-dl.c

$ PATH=$mingw64:$mingw32:$PATH ./gpg-error-dl 3
(works)

$ cp $mingw64/libgpg-error-0.dll .

$ ./gpg-error-32 3
(returns 127)

$ PATH=$mingw64:$mingw32:$PATH ./gpg-error-32 3
(works)

$ ./gpg-error-dl 3
(exit 1, LoadLibrary found nothing)

$ PATH=.:$mingw64:$mingw32:$PATH ./gpg-error-dl 3
(works)

Did I miss anything?  It seems that Windows already skips by "wrong-bit"
DLLs, regardless which is in CWD or first in PATH.


Yaakov



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