delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/11/19/23:25:34

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <4924E692.F1EFE63C@dessent.net>
Date: Wed, 19 Nov 2008 20:24:50 -0800
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: help with bash/readline dll interaction bug
References: <4924E120 DOT 2090605 AT byu DOT net>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Eric Blake wrote:

> Is there
> some slick way to make bash grab a function pointer that can see through
> the trampoline and see that bash's trampoline version of rl_tab_insert is
> indeed the same function as readline's local rl_tab_insert?

Sure, arrange for there to be a __declspec(dllimport) on rl_tab_insert's
prototype when its header is used in bash (but not when it's used in
building readline itself.)  When you use explicit dllimport there's no
need for the thunk and thus function pointers will compare as expected.

The thunk stub is really a crutch that dates back eons ago to a time
when support in compilers for DLLs was still new, as a way to let people
link to DLLs with old compilers that didn't yet support the __declspec
keyword.  The fact that it is also handy for porting *nix code that
doesn't traditionally use __declspec is a convenient coincidence.

> Would using
> gcc-4 have any impact on this?

Not that I am aware of.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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