oneShot, compileFile,
-- Interfaces for the batch-mode driver
- staticLink,
+ linkBinary,
-- Interfaces for the compilation manager (interpreted/batch-mode)
preprocess,
compile, CompResult(..),
link,
- -- DLL building
- doMkDLL,
-
) where
#include "HsVersions.h"
-- Don't showPass in Batch mode; doLink will do that for us.
let link = case ghcLink dflags of
- MkDLL -> doMkDLL
- LinkBinary -> staticLink
+ LinkBinary -> linkBinary
+ LinkDynLib -> linkDynLib
link dflags obj_files pkg_deps
debugTraceMsg dflags 3 (text "link: done")
- -- staticLink only returns if it succeeds
+ -- linkBinary only returns if it succeeds
return Succeeded
| otherwise
| otherwise
= case ghcLink dflags of
NoLink -> return ()
- LinkBinary -> staticLink dflags o_files link_pkgs
- MkDLL -> doMkDLL dflags o_files link_pkgs
+ LinkBinary -> linkBinary dflags o_files link_pkgs
+ LinkDynLib -> linkDynLib dflags o_files []
where
-- Always link in the haskell98 package for static linking. Other
-- packages have to be specified via the -package flag.
-- wrapper script calling the binary. Currently, we need this only in
-- a parallel way (i.e. in GUM), because PVM expects the binary in a
-- central directory.
--- This is called from staticLink below, after linking. I haven't made it
+-- This is called from linkBinary below, after linking. I haven't made it
-- a separate phase to minimise interfering with other modules, and
-- we don't need the generality of a phase (MoveBinary is always
-- done after linking and makes only sense in a parallel setup) -- HWL
-- read any interface files), so the user must explicitly specify all
-- the packages.
-staticLink :: DynFlags -> [FilePath] -> [PackageId] -> IO ()
-staticLink dflags o_files dep_packages = do
+linkBinary :: DynFlags -> [FilePath] -> [PackageId] -> IO ()
+linkBinary dflags o_files dep_packages = do
let verb = getVerbFlag dflags
output_fn = exeFileName dflags
"a.out"
#endif
------------------------------------------------------------------------------
--- Making a DLL (only for Win32)
-
-doMkDLL :: DynFlags -> [String] -> [PackageId] -> IO ()
-doMkDLL dflags o_files dep_packages = do
+linkDynLib :: DynFlags -> [String] -> [PackageId] -> IO ()
+linkDynLib dflags o_files dep_packages = do
let verb = getVerbFlag dflags
let static = opt_Static
let no_hs_main = dopt Opt_NoHsMain dflags
= NoLink -- Don't link at all
| LinkBinary -- Link object code into a binary
| LinkInMemory -- Use the in-memory dynamic linker
- | MkDLL -- Make a DLL
+ | LinkDynLib -- Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
deriving Eq
isNoLink :: GhcLink -> Bool
-------- Linking ----------------------------------------------------
, ( "c" , NoArg (upd $ \d -> d{ ghcLink=NoLink } ))
, ( "no-link" , NoArg (upd $ \d -> d{ ghcLink=NoLink } )) -- Dep.
- , ( "-mk-dll" , NoArg (upd $ \d -> d{ ghcLink=MkDLL } ))
+ , ( "shared" , NoArg (upd $ \d -> d{ ghcLink=LinkDynLib } ))
------- Libraries ---------------------------------------------------
, ( "L" , Prefix addLibraryPath )