This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: does LD_PRELOAD work under cygwin?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]