delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/04/10:50:01

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 <cgf-use-the-mailinglist-please AT cygwin DOT com>
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
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
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

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 <fcntl.h>
>
>int main()
>{
>    open("", 1);
>    return 0;
>}
>
>
>and testlib.c is:
>
>#include <stdio.h>
>
>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

- Raw text -


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