X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 4 Dec 2009 10:49:39 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: does LD_PRELOAD work under cygwin? Message-ID: <20091204154939.GA29605@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4B189861 DOT 9090702 AT mozdev DOT org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B189861.9090702@mozdev.org> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Fri, Dec 04, 2009 at 01:04:33PM +0800, basic wrote: >Hi, > Does LD_PRELOAD work under cygwin? I've tried the following without success: > >gcc test.c >gcc -shared testlib.c -o testlib.dll > >LD_PRELOAD=$HOME/testlib.dll ./a.exe > >where test.c is: > >#include > >int main() >{ > open("", 1); > return 0; >} > > >and testlib.c is: > >#include > >int open(const char *s, int i, ...) >{ > puts("test"); > return 0; >} > >Is there anything I'm doing wrong? Or is it just not supported? If the above is exactly what you are doing then you're not marking open as "dllexport" so it won't be callable. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple