Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Sudden exit in GHCi for FFI code - works when run as executable
## Summary I am integrating a C++ library into a project for musical live coding - so GHCi is always used. My integration works when the project is run as an executable via `cabal v2-run` but not when run via `cabal v2-repl`. GHCi exists with exit code 541541187 which corresponds to 0x20474343, which seems to be a fairly common, but unspecific, error code. ## Steps to reproduce The code to reproduce exists here: https://github.com/Zalastax/Tidal/tree/tidal-link/tidal-link ( https://github.com/Zalastax/Tidal/commit/1e5bc9f121abfd2d3c47cb778778b9f7b1dbda9a ). Check out the linked commit, run `git submodule update --init --recursive`. Go to the `tidal-link` directory. Run `cabal v2-run` and observe that it cleanly exits after pressing enter 6 times (there are a few `getLine`). ``` $ cabal v2-run Up to date "hello" "Created link" "gotline" "Link enabled" "gotline" "Created sessionState" "gotline" "Now: 690261494419" "gotline" "gotline" "beat: 20.418723" "gotline" "Now': 690266558073" "beat': 27.845418" ``` Follow up by running `cabal v2-repl`, call `hello` (which is `IO ()`), press enter twice, notice that it crashes. ``` $ cabal v2-repl Resolving dependencies... Build profile: -w ghc-9.2.1 -O1 In order, the following will be built (use -v for more details): - tidal-link-0.0.1 (lib) (configuration changed) Configuring library for tidal-link-0.0.1.. Preprocessing library for tidal-link-0.0.1.. GHCi, version 9.2.1: https://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Sound.Tidal.Link ( C:\\Users\ekrapie\programming\Tidal\dist-newstyle\build\x86_64-windows\ghc-9.2.1\tidal-link-0.0.1\build\Sound\Tidal\Link.hs, interpreted ) Ok, one module loaded. ghci> hello "hello" "Created link" "gotline" "Now: 692484810696" "gotline" "Link enabled" cabal.exe: repl failed for tidal-link-0.0.1. The build process terminated with exit code 541541187 ``` If I instead build a .dll and make my FFI calls towards that .dll, the code does not crash in GHCi. See follow-up commit https://github.com/Zalastax/Tidal/commit/6d3c67124d9f0ac1e183288ceaa954d9b0bc6df6. ## Expected behavior I expect that the program should work both when run as executable and in GHCi. ## Environment * GHC version used: `GHC 9.0.1` or `GHC 9.2.1` Optional: * Operating System: Windows 10 * System Architecture: X64
issue