From 269949584b7c124e95543c5c006822db4cec4d8b Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 14 Jul 2009 16:56:31 +0000 Subject: [PATCH] Add the -fno-shared-implib flag Patch from Max Bolingbroke Rerecorded to avoid conflicts. --- compiler/main/DriverPipeline.hs | 4 +++- compiler/main/DynFlags.hs | 4 ++++ docs/users_guide/flags.xml | 6 ++++++ docs/users_guide/phases.xml | 22 ++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 1849c6b..c4ac65f 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1590,7 +1590,9 @@ linkDynLib dflags o_files dep_packages = do , SysTools.Option "-o" , SysTools.FileOption "" output_fn , SysTools.Option "-shared" - , SysTools.FileOption "-Wl,--out-implib=" (output_fn ++ ".a") + ] ++ + [ SysTools.FileOption "-Wl,--out-implib=" (output_fn ++ ".a") + | dopt Opt_SharedImplib dflags ] ++ map (SysTools.FileOption "") o_files ++ map SysTools.Option ( diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index bebea76..37f1171 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -310,6 +310,7 @@ data DynFlag | Opt_GenManifest | Opt_EmbedManifest | Opt_EmitExternalCore + | Opt_SharedImplib -- temporary flags | Opt_RunCPS @@ -694,6 +695,8 @@ defaultDynFlags = Opt_DoAsmMangling, + Opt_SharedImplib, + Opt_GenManifest, Opt_EmbedManifest, Opt_PrintBindContents @@ -1742,6 +1745,7 @@ fFlags = [ ( "gen-manifest", Opt_GenManifest, const Supported ), ( "embed-manifest", Opt_EmbedManifest, const Supported ), ( "ext-core", Opt_EmitExternalCore, const Supported ), + ( "shared-implib", Opt_SharedImplib, const Supported ), ( "implicit-import-qualified", Opt_ImplicitImportQualified, const Supported ) ] diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index bfffb09..0b22a39 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -1833,6 +1833,12 @@ dynamic - + + + Don't generate an import library for a DLL (Windows only) + dynamic + - + diff --git a/docs/users_guide/phases.xml b/docs/users_guide/phases.xml index 2026a34..ec14364 100644 --- a/docs/users_guide/phases.xml +++ b/docs/users_guide/phases.xml @@ -1052,6 +1052,28 @@ $ cat foo.hspp />). + + + + + + + + + DLLs on Windows are typically linked to by linking to a corresponding + .lib or .dll.a - the so-called import library. + GHC will typically generate such a file for every DLL you create by compiling in + -shared mode. However, sometimes you don't want to pay the + disk-space cost of creating this import library, which can be substantial - it + might require as much space as the code itself, as Haskell DLLs tend to export + lots of symbols. + + As long as you are happy to only be able to link to the DLL using + GetProcAddress and friends, you can supply the + flag to disable the creation of the import + library entirely. + + -- 1.7.10.4