To create a `static' DLL, i.e. one that does not depend on the GHC DLLs, compile up your Haskell code using <Option>-static</Option>, and write a <Filename>.def</Filename> file containing the entry points you want to expose (see <XRef LinkEnd="win32-dlls-foreign"> for an example). Then link the DLL adding the <Option>-static</Option> flag, and <Option>-optdll--def=foo.def</Option>, where <Filename>foo.def</Filename> is the name of your <Filename>.def</Filename> file.
To create a `static' DLL, i.e. one that does not depend on the GHC DLLs,
use the <Option>-static</Option> when compiling up your Haskell code and
building the DLL.
</Para>
<Para>
...
...
@@ -112,15 +117,22 @@ A couple of things to notice:
<Para>
Since DLLs correspond to packages (see <XRef LinkEnd="packages">) you need
to use <Option>-package-name dll-name</Option> when compiling modules that
belong to a DLL. If you don't, Haskell code that calls entry points in that
DLL will do so incorrectly, and a crash will result.
belong to a DLL if you're going to call them from Haskell. Otherwise, Haskell
code that calls entry points in that DLL will do so incorrectly, and crash.
For similar reasons, you can only compile a single module tree into a DLL,
as <Function>startupHaskell</Function> needs to be able to call its
initialisation function, and only takes one such argument (see <XRef
LinkEnd="win32-dlls-foreign">). Hence the modules
you compile into a DLL must have a common root.
</Para>
</ListItem>
<ListItem>
<Para>
By default, the entry points of all the object files will
be exported from the DLL when using <Option>--mk-dll</Option>. Should you want to constrain this, you can specify the <Emphasis>module definition file</Emphasis> to use on the command line as follows:
By default, the entry points of all the object files will be exported from
the DLL when using <Option>--mk-dll</Option>. Should you want to constrain
this, you can specify the <Emphasis>module definition file</Emphasis> to use