Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 924641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:23:19+00:00 2026-05-15T19:23:19+00:00

I need to create dll for this module module MarketNews where import Foreign import

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:23:20+00:00Added an answer on May 15, 2026 at 7:23 pm

    GHC 6.12 supports creating a single DLL containing a Haskell library and all of its dependencies, including the RTS. It can’t create separate DLLs of Haskell code that call each other, although that feature is implemented and may be available in the forthcoming GHC 6.14.1.

    To answer your question, you need to also link in the HighAPI module when you create the DLL with ghc -shared. More information about creating Haskell DLLs is available in a blog post by Neil Mitchell (read this, because the information in the GHC user guide is wrong about a few things, in particular how to use DllMain).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a DNN 4.9.5 module and need to create a DLL from a
I need to create a Java applet which loads a local DLL. It works
I have a need to create a wrapper for a DLL, loading and unloading
For my application (an MMC snap-in) I need to create a single native DLL
Using reflection, I need to investigate a user DLL and create an object of
I need to have a .NET 3.5 DLL have its own config file. This
I have created a dll in vc++ and i need this dll to communicate
I need to create an ActiveX DLL (not a control). I know that VB6
I need to create a windows DLL that exports functions and has a graphical
I want to create a .dll (in C++) that uses RAPI. For this I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.