This is the mail archive of the cygwin-xfree@sourceware.cygnus.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: dlopen error


"Suhaib M. Siddiqi" <ssiddiqi@inspirepharm.com> writes:
> Mumit once mentioned that dlopn error is a bug in Cygwin.

There are two separate set of bugs in dlopen:
  - pathname searching -- fixed in b20.1 (see ChangeLog entries for 
    dlfcn.cc:get_dll_full_pathname())
  - fork doesn't reload dlopen'd libraries due to a small error. Will
    be fixed next release. 

I doubt if either is responsible for your problem below.

> Anyone has any suggestions on a wrokaround for the following problem?
> When I satrt X-server for Glide, I get dlopen error *unable to open lib:
> dlopen: Win32 error 127*.
> The dll is in path.  libGGI finds it and reports the correct
> path:/usr/local/lib/ggi\display/glide-0-0-0.dll, but still returns the
> dlopen failure.
> 
> Suhaib
> 
> bash-2.02$ LibGII: Debugging=255
> LibGGI: Debugging=255
> LibGGI: ggiOpen("glide") called
> LibGGI: Loading driver glide
> LibGGI: _ggiAddDL(0x10070fb8, "glide", "(null)", 0x1) called
> LibGGI: _ggiLoadDL("/usr/local/lib/ggi\display/glide-0-0-0.dll", 0x1) called
> LibGG: unable to open lib: dlopen: Win32 error 127

This means "The specified function cannot be found" or some such thing.
I love these descriptive error codes ;-) I'm appending a simple program
that will translate error codes for you. Just compile and run error 
code(s) as command line arguments.

I suggest the following: write a trivial 5-liner that dlopen's the 
glide-0-0-dll. If successful, we'll look further; if not, then we have
a problem with either the entry point or any of the other dozens or so
things that can go wrong.

I haven't paid much attention the DLL building code in ggi (via libtool);
I'll do so today and take a look. My suspicion is in the DllMain is done,
but I may be way off. BTW, can you make sure that all the dependent DLLs
for ggi-0-0-0.dll are in your PATH or in the same directory as ggi-*.dll?

To find dependent DLLs:
  
  $ objdump -p ggi-0-0-0.dll | grep "DLL Name"

Run with STRACE=1,foo.out and see what foo.out says.

Regards,
Mumit

=== cut from here to end.
/*
 * win32-errmsg: Translate win32 error codes to text messages.
 *
 * Usage: win32-errmsg [error-code [error-code ...]]
 *
 */

#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

void
format_error (char *msg, int msglen, int errnum)
{
  if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
		     | FORMAT_MESSAGE_IGNORE_INSERTS,
		     NULL,
		     errnum,
		     MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
		     (LPTSTR) msg,
		     msglen,
		     NULL))
    {
      msg [strlen (msg) - 2] = '\0';
    }
  else
    {
      sprintf (msg, "Win32 error %d", errnum);
    }
}


int 
main (int argc, char *argv[])
{
  int i;
  for (i = 1; i < argc; i++)
    {
      int errnum = atoi (argv[i]);
      char msg[256];

      sprintf (msg, "%s (Error %d): ", argv[0], errnum);
      format_error (msg + strlen (msg), sizeof (msg) - strlen (msg), errnum);
      puts (msg);
    }
  return 0;
}


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