Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
9dbc74ba
Commit
9dbc74ba
authored
May 10, 1999
by
sof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 1999-05-10 08:23:55 by sof]
Added a DllMain() which starts up RTS upon DLL load.
parent
9f093c85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
19 deletions
+60
-19
ghc/includes/Stg.h
ghc/includes/Stg.h
+2
-2
ghc/rts/Main.c
ghc/rts/Main.c
+41
-6
ghc/rts/Makefile
ghc/rts/Makefile
+13
-6
ghc/rts/RtsStartup.c
ghc/rts/RtsStartup.c
+4
-5
No files found.
ghc/includes/Stg.h
View file @
9dbc74ba
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
* $Id: Stg.h,v 1.1
0
1999/05/0
4
08:
52:22
sof Exp $
* $Id: Stg.h,v 1.1
1
1999/05/
1
0 08:
23:57
sof Exp $
*
*
* (c) The GHC Team, 1998-1999
* (c) The GHC Team, 1998-1999
*
*
...
@@ -119,7 +119,7 @@ void _stgAssert (char *, unsigned int);
...
@@ -119,7 +119,7 @@ void _stgAssert (char *, unsigned int);
#include "Hooks.h"
#include "Hooks.h"
/* Misc stuff without a home */
/* Misc stuff without a home */
#ifdef
BU
IL
D
ING_RTS
_DLL
#if
def
ined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMP
ILING_RTS
)
extern
DLLIMPORT
char
**
prog_argv
;
/* so we can get at these from Haskell */
extern
DLLIMPORT
char
**
prog_argv
;
/* so we can get at these from Haskell */
extern
DLLIMPORT
int
prog_argc
;
extern
DLLIMPORT
int
prog_argc
;
#else
#else
...
...
ghc/rts/Main.c
View file @
9dbc74ba
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
* $Id: Main.c,v 1.
6
1999/0
3/03 19:20:42
sof Exp $
* $Id: Main.c,v 1.
7
1999/0
5/10 08:23:55
sof Exp $
*
*
* (c) The GHC Team 1998-1999
* (c) The GHC Team 1998-1999
*
*
...
@@ -29,21 +29,28 @@
...
@@ -29,21 +29,28 @@
#include "LLC.h"
#include "LLC.h"
#endif
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifndef ENABLE_WIN32_DLL_SUPPORT
/* Hack: we assume that we're building a batch-mode system unless
/* Hack: we assume that we're building a batch-mode system unless
* INTERPRETER is set
* INTERPRETER is set
*/
*/
#ifndef INTERPRETER
/* Hack */
#
ifndef INTERPRETER
/* Hack */
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
SchedulerStatus
status
;
SchedulerStatus
status
;
startupHaskell
(
argc
,
argv
);
startupHaskell
(
argc
,
argv
);
#ifndef PAR
#
ifndef PAR
MainTSO
=
createIOThread
(
stg_max
(
BLOCK_SIZE_W
,
MainTSO
=
createIOThread
(
stg_max
(
BLOCK_SIZE_W
,
RtsFlags
.
GcFlags
.
initialStkSize
),
RtsFlags
.
GcFlags
.
initialStkSize
),
(
StgClosure
*
)
&
mainIO_closure
);
(
StgClosure
*
)
&
mainIO_closure
);
status
=
schedule
(
MainTSO
,
NULL
);
status
=
schedule
(
MainTSO
,
NULL
);
#else
#
else
if
(
IAmMainThread
==
rtsTrue
)
{
if
(
IAmMainThread
==
rtsTrue
)
{
/*Just to show we're alive */
/*Just to show we're alive */
fprintf
(
stderr
,
"Main Thread Started ...
\n
"
);
fprintf
(
stderr
,
"Main Thread Started ...
\n
"
);
...
@@ -56,7 +63,7 @@ int main(int argc, char *argv[])
...
@@ -56,7 +63,7 @@ int main(int argc, char *argv[])
WaitForPEOp
(
PP_FINISH
,
SysManTask
);
WaitForPEOp
(
PP_FINISH
,
SysManTask
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
#endif
/* PAR */
#
endif
/* PAR */
switch
(
status
)
{
switch
(
status
)
{
case
AllBlocked
:
case
AllBlocked
:
barf
(
"Scheduler stopped, all threads blocked"
);
barf
(
"Scheduler stopped, all threads blocked"
);
...
@@ -72,4 +79,32 @@ int main(int argc, char *argv[])
...
@@ -72,4 +79,32 @@ int main(int argc, char *argv[])
shutdownHaskell
();
shutdownHaskell
();
stg_exit
(
EXIT_SUCCESS
);
stg_exit
(
EXIT_SUCCESS
);
}
}
#endif
/* BATCH_MODE */
# endif
/* BATCH_MODE */
#else
/* !ENABLE_WIN32_DLL_SUPPORT */
static
char
*
args
[]
=
{
"ghcRts"
};
BOOL
WINAPI
DllMain
(
HINSTANCE
hInstance
,
DWORD
reason
,
LPVOID
reserved
)
{
/*
ToDo: let the user configure RTS options to use
via the registry.
*/
switch
(
reason
)
{
case
DLL_PROCESS_ATTACH
:
startupHaskell
(
args
,
1
);
/* ToDo: gracefully handle startupHaskell() failures.. */
return
TRUE
;
case
DLL_PROCESS_DETACH
:
shutdownHaskell
();
}
return
TRUE
;
}
#endif
/* !ENABLE_WIN32_DLL_SUPPORT */
ghc/rts/Makefile
View file @
9dbc74ba
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.
9
1999/05/
04 10:19:17
sof Exp $
# $Id: Makefile,v 1.
10
1999/05/
10 08:23:55
sof Exp $
# This is the Makefile for the runtime-system stuff.
# This is the Makefile for the runtime-system stuff.
# This stuff is written in C (and cannot be written in Haskell).
# This stuff is written in C (and cannot be written in Haskell).
...
@@ -88,14 +88,21 @@ unexport CC
...
@@ -88,14 +88,21 @@ unexport CC
#
#
ifeq
"$(way)" "dll"
ifeq
"$(way)" "dll"
DLL_NAME
=
HSrts.dll
DLL_NAME
=
HSrts.dll
SRC_BLD_DLL_OPTS
+=
--def
HSrts.def
-lwinmm
-lHS_imp
-lgmp
-L
.
-Lgmp
SRC_BLD_DLL_OPTS
+=
--def
HSrts.def
-lwinmm
-lHS_imp
_stub
-lgmp
-L
.
-Lgmp
LIBOBJS
:=
$(
filter-out
Main.
$(way_)
o,
$(LIBOBJS)
)
#
# Need an import library containing the symbols the RTS uses from the Prelude.
# So, to avoid bootstrapping trouble, we build one containing just the syms
# we need. Weirdly named to avoid clashing later on when compiling the contents
# of ghc/lib/..
#
# Note: if you do change the name of the Prelude DLL, the "--dllname <nm>.dll"
# below will need to be updated as well.
$(DLL_NAME)
::
libHS_imp.a
$(DLL_NAME)
::
libHS_imp
_stub
.a
libHS_imp.a
:
libHS_imp
_stub
.a
:
dlltool
--output-lib
libHS_imp.a
--def
HSprel.def
--dllname
HSprel.dll
dlltool
--output-lib
libHS_imp
_stub
.a
--def
HSprel.def
--dllname
HSprel.dll
# It's not included in the DLL, but we need to compile it up separately.
# It's not included in the DLL, but we need to compile it up separately.
all
::
Main.dll_o
all
::
Main.dll_o
...
...
ghc/rts/RtsStartup.c
View file @
9dbc74ba
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
* $Id: RtsStartup.c,v 1.1
1
1999/05/
04 10:19:19
sof Exp $
* $Id: RtsStartup.c,v 1.1
2
1999/05/
10 08:23:56
sof Exp $
*
*
* (c) The GHC Team, 1998-1999
* (c) The GHC Team, 1998-1999
*
*
...
@@ -35,7 +35,8 @@
...
@@ -35,7 +35,8 @@
*/
*/
struct
RTS_FLAGS
RtsFlags
;
struct
RTS_FLAGS
RtsFlags
;
extern
void
startupHaskell
(
int
argc
,
char
*
argv
[])
void
startupHaskell
(
int
argc
,
char
*
argv
[])
{
{
static
int
rts_has_started_up
=
0
;
static
int
rts_has_started_up
=
0
;
int
i
;
int
i
;
...
@@ -87,7 +88,7 @@ extern void startupHaskell(int argc, char *argv[])
...
@@ -87,7 +88,7 @@ extern void startupHaskell(int argc, char *argv[])
prog_argc
=
argc
;
prog_argc
=
argc
;
prog_argv
=
argv
;
prog_argv
=
argv
;
#if
def
ined(
PAR
)
#ifdef
PAR
/* Initialise the parallel system -- before initHeap! */
/* Initialise the parallel system -- before initHeap! */
initParallelSystem
();
initParallelSystem
();
/* And start GranSim profiling if required: omitted for now
/* And start GranSim profiling if required: omitted for now
...
@@ -122,8 +123,6 @@ extern void startupHaskell(int argc, char *argv[])
...
@@ -122,8 +123,6 @@ extern void startupHaskell(int argc, char *argv[])
filling in the tables with references to where the
filling in the tables with references to where the
static info tables have been loaded inside the running
static info tables have been loaded inside the running
process.
process.
Ditto for Bool closure tbl.
*/
*/
#ifdef ENABLE_WIN32_DLL_SUPPORT
#ifdef ENABLE_WIN32_DLL_SUPPORT
for
(
i
=
0
;
i
<=
255
;
i
++
)
for
(
i
=
0
;
i
<=
255
;
i
++
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment