I need to create a dll for this module
module MarketNews where
import Foreign
import Foreign.C.Types
import Foreign.C.String
import HighAPI(getNextNewsInfo)
getNextNewsInfoM :: IO CString
getNextNewsInfoM = getNextNewsInfo >>= \x -> newCString x
foreign export stdcall getNextNewsInfoM :: IO CString
I compiled:
C:\Users\test_8\Documents\Project\MarketNews\src>ghc --make MarketNews.hs -fglasgow
-exts
I also have dllMain.o, which is created as http://haskell.org/ghc/docs/6.12.1/html/users_guide/win32-dlls.html and MyDef.def. After that I will do the following:
C:\Users\test_8\Documents\Project\MarketNews\src>ghc -shared -o MarketNews.dll M
arketNews.o MarketNews_stub.o dllMain.o MyDef.def
Creating library file: MarketNews.dll.a
Warning: resolving _getNextNewsInfoM by linking to _getNextNewsInfoM@0
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
MarketNews.o:fake:(.text+0x6b): undefined reference to `HighAPI_getNextNewsInfo_
closure'
MarketNews.o:fake:(.text+0x12d): undefined reference to `__stginit_HighAPI_'
MarketNews.o:fake:(.data+0x10): undefined reference to `HighAPI_getNextNewsInfo_
closure'
collect2: ld returned 1 exit status
As I understand it, this is not possible because there must be one root module. But why can I use Foreign. *? Why can't I use the HighAPI module? Should I write the whole program in one file? Thank.
Anton source
share