haskell / haskell/c2hs

Workaround for GenBind.evalCCast error

Open
#239 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
211
Forks
52
PR merge metrics
No merged PRs in 30d

Description

I get the following message when using `enum define`:

c2hs.exe: Feature not yet implemented:
GenBind.evalCCast: Casts are implemented only for integral constants

The macros involved are `#define`ed in terms of other helper macros like:

#define WRAPPER(x) ((int)((x) & 15) << 16)
#define MACRO_ORIGIN 42
#define MACRO_TEST WRAPPER(MACRO_ORIGIN)

Then, when I refer to `MACRO_TEST` in my `.chs` file like this, `c2hs` will fail:

{#enum define Flags { MACRO_TEST as Test } deriving (Eq, Show) #}

The header file is a system header, so I cannot just modify the definition. Is there any workaround for this, or should I just rewrite `enum define` by hand?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.