2000-07-01 05:51:55 +02:00
|
|
|
/* attach_dll.cc: crt0 for attaching cygwin DLL from a non-cygwin app.
|
|
|
|
|
|
|
|
Copyright 2000 Cygnus Solutions.
|
|
|
|
|
|
|
|
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. */
|
|
|
|
|
2000-07-08 06:36:27 +02:00
|
|
|
#undef __INSIDE_CYGWIN__
|
2000-07-01 05:51:55 +02:00
|
|
|
#include <windows.h>
|
2000-07-08 06:36:27 +02:00
|
|
|
#include <sys/cygwin.h>
|
2000-07-01 05:51:55 +02:00
|
|
|
#include "crt0.h"
|
|
|
|
|
|
|
|
/* for a loaded dll */
|
|
|
|
int
|
|
|
|
cygwin_attach_dll (HMODULE h, MainFunc f)
|
|
|
|
{
|
2000-07-08 06:36:27 +02:00
|
|
|
struct per_process *u;
|
|
|
|
if (_cygwin_crt0_common (f, NULL))
|
|
|
|
u = NULL; /* Newer DLL. Use DLL internal per_process. */
|
|
|
|
else /* Older DLL. Provide a per_process */
|
|
|
|
{
|
|
|
|
u = (struct per_process *) alloca (sizeof (*u));
|
|
|
|
(void) _cygwin_crt0_common (f, u);
|
|
|
|
}
|
2000-07-01 05:51:55 +02:00
|
|
|
|
|
|
|
/* jump into the dll. */
|
2000-07-08 06:36:27 +02:00
|
|
|
return dll_dllcrt0 (h, u);
|
2000-07-01 05:51:55 +02:00
|
|
|
}
|