delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2001/04/10/11:41:22

Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-apps-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/lists.html#faqs>
Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com
Message-ID: <20010409180309.98002.qmail@web5409.mail.yahoo.com>
Date: Mon, 9 Apr 2001 11:03:09 -0700 (PDT)
From: Steve O <simgenome AT yahoo DOT com>
Reply-To: bub AT io DOT com
Subject: no-x rxvt, trying to dynamically use libX11
To: cygwin-apps AT cygwin DOT com
MIME-Version: 1.0

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019