2000-07-08 12:36:27 +08:00
|
|
|
/* cygwin_crt0.cc: crt0 for cygwin
|
2000-07-01 11:51:55 +08:00
|
|
|
|
|
|
|
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 12:36:27 +08:00
|
|
|
#undef __INSIDE_CYGWIN__
|
2000-07-01 11:51:55 +08:00
|
|
|
#include <windows.h>
|
2000-07-08 12:36:27 +08:00
|
|
|
#include <sys/cygwin.h>
|
2000-07-01 11:51:55 +08:00
|
|
|
#include "crt0.h"
|
|
|
|
|
2000-07-29 12:19:24 +08:00
|
|
|
#define alloca __builtin_alloca
|
|
|
|
|
2000-07-08 12:36:27 +08:00
|
|
|
extern void dll_crt0__FP11per_process (struct per_process *) __declspec (dllimport) __attribute ((noreturn));
|
2000-07-01 11:51:55 +08:00
|
|
|
|
|
|
|
/* for main module */
|
|
|
|
void
|
|
|
|
cygwin_crt0 (MainFunc f)
|
|
|
|
{
|
2000-07-08 12:36:27 +08: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));
|
2000-07-18 03:18:21 +08:00
|
|
|
memset (u, 0, sizeof (u));
|
2000-07-08 12:36:27 +08:00
|
|
|
(void) _cygwin_crt0_common (f, u);
|
|
|
|
}
|
|
|
|
dll_crt0__FP11per_process (u); /* Jump into the dll, never to return */
|
2000-07-01 11:51:55 +08:00
|
|
|
}
|