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: Hooks do not work?


On 2013-10-26 01:32, niXman wrote:
I try to create the hooks for open()/fopen().

hook code:
#include <stdio.h>

#ifdef __CYGWIN__
#include <sys/cygwin.h>
#endif

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);
}

#ifdef __CYGWIN__
__attribute__((constructor))
void _init(void)
{
  cygwin_internal(CW_HOOK, "open", open);
  cygwin_internal(CW_HOOK, "fopen", fopen);
}
#endif

HTH,


Yaakov


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