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

no-x rxvt, trying to dynamically use libX11


Hi,

Sorry about the delay getting the no-x rxvt put into the
official distribution.  I couldn't resolve the fact that
I was colliding with the rxvt name.  Sure, I am using
the rxvt code OOTB, but I'm hobbling it by tying it to 
windows.

So I looked into making the X-look alike into a dll, and 
using run-time dynamic loading to load either libW11 or 
libX11.   This was surprisingly easy, save for two snags:

1. DISPLAY gets set to :0 by rxvt if DISPLAY isn't set. 
   This means that an rxvt launched from an rxvt will try 
   to open the X-display.  So my initial idea of using 
   DISPLAY to control which library to use is not as 
   straight forward as I hoped.  I would like to avoid
   asking new users to modify their environment and I
   would like to avoid parsing the command line args.

2. Maybe I'm approaching this wrong, but I'm  
   making wrappers for each X routine. 
   An example:

Display *XOpenDisplay(const char *name) {
    if (!f) f=_loadfunc("XOpenDisplay");
    return (f)(name);
}

   This worked great until I hit a varargs function:

XIC XCreateIC(XIM *im, ...) { 
    if (!f1) f1=_loadfunc("XCreateIC");
    return (f1)(im, ...);
}

   The naive approach is to just pass va_list:

     va_start(valist,im);
     return (f1)(im,valist);

   But I'm guessing that a more elaborate solution is 
   needed.  Anyone have experience with wrapping 
   vararg functions?

Thanks,
-steve o



__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/


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