Hooks do not work?

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Sun Oct 27 09:52:00 GMT 2013


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



More information about the Cygwin mailing list