RFC: Cygwin 64 bit?
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Jul 8 09:56:00 GMT 2011
On Jul 8 03:57, Yaakov (Cygwin/X) wrote:
> 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*
Where did you get the mingw64 gpg-error stuff from? It's not in the
Cygwin distro.
> $ 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.
Thanks for performing these tests. I still have to see it with my own
eyes :}
OK, let's assume DLLs with the wrong bit-ness are skipped on CreateProcess
as well as on LoadLibrary. What are the implications for us?
- If we use the same "cyg" prefix, we have to split the /bin directory
into a 32 and a 64 bit bin directory, or
- if we stick to a single /bin directory, we have to use another prefix
like "cyg64", or
- we have to put the DLLs into a separate directory like /usr/lib64.
Separate directory has the problem that it always has to be in $PATH,
which is not such a good idea, IMHO.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
More information about the Cygwin-developers
mailing list