The fundamental thing is that in --make mode, GHC figures out the required
Haskell dependencies itself. So it sees the import and looks in which
package it's provided and links (if necessary) with that package.
But when you tell it to link a couple of .o files, it's not in --make mode,
so apart from the specified files it links in only symbols from a few
select packages (I think the wired-in packages), so then you have to tell
it which other packages it needs to link in.
$ ghc -shared -package regex-genex -o genexlib.dll genexlib.o
genexlib_stub.o start.o
should fix the undefined reference.
> compiling:
> >ghc -c genexlib.hs
> >ghc -c start.c
> >ghc -shared -o genexlib.dll genexlib.o genexlib_stub.o start.o
Why the separate compilation? Can't you compile them in one go?