X-Spam-Check-By: sourceware.org Date: Wed, 1 Aug 2007 14:39:26 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: is LD_PRELOAD available in cygwin? Message-ID: <20070801183926.GC6530@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <46B02E5F DOT 3080408 AT gmail DOT com> <46B0A563 DOT B672E63 AT dessent DOT net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46B0A563.B672E63@dessent.net> User-Agent: Mutt/1.5.15 (2007-04-06) 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 Wed, Aug 01, 2007 at 08:23:15AM -0700, Brian Dessent wrote: >G?nther Jedenastik wrote: > >> using g++ to compile a dll which overload's the open(); glibc system call. >> Using preload i want to load my own dll with my open(); function. using >> dlsym(); i try to load the glibc open(); function. > >Cygwin does not use glibc. glibc is Linux-specifc. > >> Q1: is LD_PRELOAD available in cygwin? if yes, any hint's why it's not >> working? (maybe some configuration problem or so, any hint would be >> helpfull) >> Q2: are there any alternative ways to preloading causing the same result? > >No, LD_PRELOAD is an aspect of ELF dynamic loaders and is not available >on Windows. It's not something that Cygwin can provide since it is a >function provided by the program loader, i.e. the operating system. Sorry, Brian, but this isn't correct. LD_PRELOAD has been available for Cygwin for a while. It's not 100% like linux but it is close. You can only override cygwin functions with it but that should work for open(). If this isn't working under cygwin, I'd suspect function decorations are not right, i.e., the open() function name being trapped doesn't look the same as the open in cygwin1.dll. ...either that or LD_PRELOAD is broken. I haven't played with it for a while. cgf -- 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/