This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Hooks do not work?
- From: niXman <i dot nixman at autistici dot org>
- To: Cygwin <cygwin at cygwin dot com>
- Date: Sat, 26 Oct 2013 10:32:51 +0400
- Subject: Hooks do not work?
- Authentication-results: sourceware.org; auth=none
Hi,
I try to create the hooks for open()/fopen().
hook code:
#include <stdio.h>
int open(const char *fname, int mode, ...) {
printf("fname=%s\n", fname);
}
FILE* fopen(const char *fname, const char *mode) {
printf("fname=%s\n", fname);
}
test code:
#include <stdio.h>
int main() {
FILE *file = fopen("main.c", "rb");
if ( file ) fclose(file);
}
compiled as:
gcc hook.c -shared -oopenhook.dll
gcc main.c -omain
run as:
LD_PRELOAD=/home/niXman/openhook.dll ./main
But a can't see the output.
What I am doing wrongly?
Thanks!
--
Regards, niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW-W64 compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingw-w64/
___________________________________________________
Another online IDE: http://liveworkspace.org/
--
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