delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/05/21:00:32

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 5 Mar 2001 20:58:35 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Patch submission for AltGr handling
Message-ID: <20010305205835.A1400@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <200103060151 DOT UAA06498 AT envy DOT delorie DOT com> <Pine DOT WNT DOT 4 DOT 32 DOT 0103051753450 DOT -350215 AT tiller2 DOT ventritex DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <Pine.WNT.4.32.0103051753450.-350215@tiller2.ventritex.com>; from jdtiller@best.com on Mon, Mar 05, 2001 at 05:56:35PM -0800

On Mon, Mar 05, 2001 at 05:56:35PM -0800, Jason Tiller wrote:
>Hi, DJ, :)
>
>On Mon, 5 Mar 2001, DJ Delorie wrote:
>> This is Jason:
>> > Thanks for the tip.  I do see how that works.  One thing I don't
>> > understand, though - why do you go through the code you do to load
>> > procedure addresses instead of LoadProcAddress()'ing them?
>
>> The idea is that the first time you call our stub function, it does
>> call LoadProcAddress.  Then it rewrites the stub to simply jump to
>> the new address, and jumps back to the stub!  The second time the
>> stub is called, it has nothing but the jump in it.
>
>> You can't just call the function, because you don't know what the
>> parameters look like (well, we do, but it's not automatic like the
>> jmp is, and jmp is faster).
>
>Ah, I see.  This saves quite a bit of code, too, it seems.  All of
>those nasty LoadProcAddress()'es and what.  Plus, it seems to have a
>serious performance advantage.  Still, gnarly code.  Thanks for the
>info!

It still calls LoadProcAddress but only if the function is actually
needed.  So, in your case, if the program never reads from the console,
the function is never loaded from user32.dll.

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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