Commit 57ff175e authored by rrt's avatar rrt
Browse files

[project @ 2000-06-27 10:08:48 by rrt]

Replace documentation for dll_Ifs.hi with a note about using -package-name.

Please merge.
parent 578c31a9
......@@ -40,12 +40,11 @@ sh$
</Para>
<Para>
will give you a binary as before, but the <Filename>main.exe</Filename> generated
will use the Prelude and RTS DLLs instead.
will give you a binary as before, but the <Filename>main.exe</Filename> generated will use the Prelude and RTS DLLs instead.
</Para>
<Para>
6K for a <Literal>"hello, world"</Literal> application - not bad, huh? :-)
6K for a <Literal>"hello, world"</Literal> application---not bad, huh? :-)
</Para>
</Sect1>
......@@ -82,7 +81,7 @@ the DLL by issuing the following command:
<Para>
<Screen>
sh$ ghc --mk-dll -o HSsuper.dll A.o Super.o B.o libmine.a -lgdi32
ghc --mk-dll -o HSsuper.dll A.o Super.o B.o libmine.a -lgdi32
</Screen>
</Para>
......@@ -103,56 +102,11 @@ A couple of things to notice:
<ListItem>
<Para>
When compiling the module <Literal>A</Literal>, the code emitted by the compiler
differs depending on whether or not the functions and data it is
importing from other Haskell modules correspond to symbols that are
packaged up in a ghc-compiled DLL. To resolve whether such imports are
'DLL imports' or not, the following rules are used:
<ItemizedList>
<ListItem>
<Para>
If the compiler imports from a module that's in the same directory as
the one being compiled, it is assumed to not belong to a different DLL
(or executable) than the module being processed, so none of the
same-directory imports are considered 'DLL imports'.
</Para>
</ListItem>
<ListItem>
<Para>
If a directory contains the (probably empty) file
<Filename>dLL&lowbar;ifs.hi</Filename>, the code corresponding to the interface
files found in that directory are assumed to live in a DLL
separate from the one being compiled.
Notice that the first rule takes precedence over this one, so if
you're compiling a module that imports from a Haskell module whose
interface file live in the same directory, <Emphasis>and</Emphasis> that directory
also contains the file <Filename>dLL&lowbar;ifs.hi</Filename>, the import is still not
being considered to be a 'DLL import'.
</Para>
</ListItem>
<ListItem>
<Para>
If compiling with the option <Option>-static</Option>, the previous rule
is disabled.
</Para>
</ListItem>
</ItemizedList>
So, in short, after having built your Haskell DLL, make sure you
create the file <Filename>dLL&lowbar;ifs.hi</Filename> in the directory that contains
its interface files. If you don't, Haskell code that calls upon entry
points in that DLL, will do so incorrectly, and a crash will result.
(it is unfortunate that this isn't currently caught at compile-time).
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.
</Para>
</ListItem>
......@@ -160,21 +114,16 @@ points in that DLL, will do so incorrectly, and a crash will result.
<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:
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:
<Screen>
sh$ ghc --mk-dll -o .... -optdll--def -optdllMyDef.def
ghc --mk-dll -o .... -optdll--def -optdllMyDef.def
</Screen>
See Microsoft documentation for details, but a module definition file
simply lists what entry points you want to export. Here's one that's
suitable when building a Haskell COM server DLL:
<ProgramListing>
EXPORTS
DllCanUnloadNow = DllCanUnloadNow@0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment