delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/04/00:04:51

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B189861.9090702@mozdev.org>
Date: Fri, 04 Dec 2009 13:04:33 +0800
From: basic <basic AT mozdev DOT org>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090928 Thunderbird/3.0b4
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: does LD_PRELOAD work under cygwin?
X-IsSubscribed: yes
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

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?

--
basic



--
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