This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 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: LoadLibrary("cygx11-6.dll") results in STATUS_ACCESS_VIOLATION


here's my piece of code:
int main(int argc,char **argv)
{
 HINSTANCE hInst = LoadLibrary("cygwin1.dll");
 void *(*pfdlOpen)(char *,int) = (void *(*)(char
*,int))GetProcAddress(hInst,"dlopen");
 int   (*pfdlClose)(void *) =
(int(*)(void*))GetProcAddress(hInst,"dlclose");
 void *(*pfdlSym)(void *,const char *) = (void *(*)(void *,const char
*))GetProcAddress(hInst,"dlsym");

 void * hXInst = pfdlOpen("cygwin1.dll",RTLD_LAZY);

 if (hInst)
 {
  Display *(*pfXOpenDisplay)(char *) = NULL;

  pfXOpenDisplay = (Display *(*)(char *))pfdlSym(hXInst,"XOpenDisplay");
  if(pfXOpenDisplay)
  {
   Display *pxDisplay = NULL;

   pxDisplay = pfXOpenDisplay("127.0.0.1:0.0");
   if(pxDisplay)
   {
   }
   else
   {
    printf("Could not connect to X Server");
   }
  }
  pfdlClose(hXInst);
 }
}

note that I am using MSVC 6

thanks
samer
----- Original Message -----
From: "Samer El Boustany" <samer.boustany@neuf.fr>
To: "Samer El Boustany" <samer.boustany@neuf.fr>; <cygwin-xfree@cygwin.com>
Sent: Sunday, October 24, 2004 11:35 PM
Subject: Re: LoadLibrary("cygx11-6.dll") results in STATUS_ACCESS_VIOLATION


> Thank you for your replies.
> I tried the dlopen and it gets into an inifinite loop. Any idea why?
>
> thanks
> samer
>
> Charles Wilson wrote:
> LoadLibrary usually works okay --- but it'd certainly be better, from a
> cygwin POV, to use cygwin1.dll's dlopen() instead. And there is sometimes
a
> good reason to avoid direct linking: what if you want to "turn on" various
> windowing/GUI modes...e.g. rxvt on cygwin can currently be used without an
> Xserver running, without even having the X libs installed. If $DISPLAY is
> :0, it never tries to load the X stuff, but simply uses Windows GDI. If
the
> Xlibs were linked directly into the app, you'd always have to have the
Xlibs
> installed, even if you didn't want to ever use rxvt in "X11" mode.
>
> ----- Original Message -----
> From: "Samer El Boustany" <samer.boustany@neuf.fr>
> To: <cygwin-xfree@cygwin.com>
> Sent: Sunday, October 24, 2004 7:49 PM
> Subject: LoadLibrary("cygx11-6.dll") results in STATUS_ACCESS_VIOLATION
>
>
> > Hi,
> > I am trying to write an x client application that will run on a windows
xp
> > machine. When I try to load any X related dll (in order to be able to
call
> > for example XOpenDisplay) the executable exits whith the message
> > 5 [main] test3 2820 handle_exceptions: Exception:
STATUS_ACCESS_VIOLATION
> > 648 [main] test3 2820 open_stackdumpfile: Dumping stack trace to
> > test3.exe.tackdump
> >
> > This dump occurs when the system tries to load the library.
> >
> > Any help would be appreciated.
> >
> > thanks
> > samer
> >
>
>
>



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