Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct signatures for FinalizerPtrs #57

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Conversation

amesgen
Copy link
Contributor

@amesgen amesgen commented May 2, 2023

We have the signature

int inflateEnd(z_streamp strm);

in contrast to

type FinalizerPtr a = FunPtr (Ptr a -> IO ())

so we have a return type mismatch. This doesn't seem to matter on most platforms, but causes errors for WASM/WASI.


Also adds a CI job for GHC WASM/WASI 9.6 and 9.8.

@amesgen amesgen marked this pull request as draft May 2, 2023 19:56
@amesgen amesgen force-pushed the wasm branch 2 times, most recently from 6a9ce44 to 99fc84d Compare May 2, 2023 20:27
@Bodigrim
Copy link
Contributor

@amesgen could you please rebase and add CI job?

It's fine to modify cabal.project during CI build, e. g.,

    - name: Build
      run: |
        rm -f cabal.project
        cat > cabal.project <<EOF
        packages: .
        if os(wasi)
          -- https://github.com/haskellari/splitmix/pull/73
          source-repository-package
            type: git
            location: https://github.com/amesgen/splitmix
            tag: ebd790e992a83fe1b16b6182677106295d9afba2
        EOF

        wasm32-wasi-cabal build all -f+bundled-c-zlib

@amesgen amesgen marked this pull request as ready for review October 25, 2023 09:56
@@ -101,7 +101,10 @@ library
build-tools: hsc2hs >= 0.67 && < 0.69
-- GHC 7 ships hsc2hs-0.67

includes: zlib.h
includes: zlib.h hs-zlib.h
install-includes: hs-zlib.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment what's the deal with both includes and install-includes? I always forget the difference.

@@ -0,0 +1,8 @@
#ifndef HS_ZLIB_EXTRAS
#define HS_ZLIB_EXTRAS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an include guard. Alternatively, this could be replaced with #pragma once (with very(?) slightly reduced portability).

@@ -0,0 +1,9 @@
#include "hs-zlib.h"

void hsInflateEnd(z_streamp strm) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's mangle names even more, like _hs_zlib_inflateEnd or something.

@Bodigrim Bodigrim merged commit bf787fe into haskell:master Oct 25, 2023
@Bodigrim
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants