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

Alias ignored when casting #57

Open
arkanoid87 opened this issue Feb 2, 2023 · 1 comment
Open

Alias ignored when casting #57

arkanoid87 opened this issue Feb 2, 2023 · 1 comment

Comments

@arkanoid87
Copy link

Adding this test

talias.h

#define SCARD_S_SUCCESS                 ((long)0x00000000)

talias.nim

doAssert SCARD_S_SUCCESS == 0

results in

futhark/tests/talias.nim(26, 6) Error: undeclared identifier: 'SCARD_S_SUCCESS'

I've faced this problem while trying to wrap this

@PMunch
Copy link
Owner

PMunch commented Feb 2, 2023

Ah, the notorious C defines. This is essentially caused by macros being a pre-processor thing and as such they don't have a representation in the Clang translation unit output. So Øpir resorts to just parsing the value itself: https://github.com/PMunch/futhark/blob/master/src/opir.nim#L323-L368. So to fix this it's just a matter of improving the capabilities of that parser to support casting to long.

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

No branches or pull requests

2 participants