newlib/winsup/cygwin/init.cc

43 lines
971 B
C++
Raw Normal View History

2001-09-11 22:01:02 +02:00
/* init.cc
2000-02-17 20:38:33 +01:00
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
2000-02-17 20:38:33 +01:00
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
#include <stdlib.h>
#include "thread.h"
#include "perprocess.h"
2000-02-17 20:38:33 +01:00
int NO_COPY dynamically_loaded;
extern "C" int
WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load)
2000-02-17 20:38:33 +01:00
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
cygwin_hmodule = (HMODULE) h;
2000-02-17 20:38:33 +01:00
dynamically_loaded = (static_load == NULL);
break;
case DLL_PROCESS_DETACH:
break;
2000-02-17 20:38:33 +01:00
case DLL_THREAD_ATTACH:
if (user_data->threadinterface)
{
if (!TlsSetValue (user_data->threadinterface->reent_index,
&user_data->threadinterface->reents))
api_fatal ("thread initialization failed");
}
2000-02-17 20:38:33 +01:00
break;
case DLL_THREAD_DETACH:
/* not invoked */;
2000-02-17 20:38:33 +01:00
break;
}
return 1;
}