Hello . I need to create 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
Also i have dllMain.o which created like http://haskell.org/ghc/docs/6.12.1/html/users_guide/win32-dlls.html and MyDef.def. After that i do next:
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 faild because there must be a single root module. But why do i can use Foreign.* ? Why does i can not use HighAPI module ? Should i write whole programm in one file ? Thanks.