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

Add some functions, fix some stuff #4

Merged
merged 5 commits into from
Jan 27, 2021
Merged

Conversation

lunabunn
Copy link
Contributor

  • BOOL should be a typedef for c_int
  • PFD_TYPE_RGBA, PFG_TYPE_COLORINDEX, PFD_MAIN_PLANE, PFD_OVERLAY_PLANE, and PFD_UNDERLAY_PLANE should be BYTE
  • c_struct! should generate structs with public fields
  • Add the following functions:
    • GetProcAddress
    • DescribePixelFormat
  • Add the following types:
    • FARPROC
    • NEARPROC

BOOL should be an alias of c_int
Make c_struct! generated structs' fields public
Add GetProcAddress and DescribePixelFormat
@lunabunn
Copy link
Contributor Author

lunabunn commented Jan 26, 2021

There are a lot of other constant types that are wrong, but 🤷

As per #2, is the convention meant to be that consts are left as u32 and the user casts them as appropriate? Not sure why this would be preferred over just having consts be the correct type. Or did I just misinterpret the issue?

@Lokathor
Copy link
Owner

There's places where the C api isn't even consistent about what type a value is supposed to be, is the problem.

I can accept the new types and externs, but the changes to types are a breaking change technically.

If there is gonna be a 2.0 we should go farther and use more actual newtyping and repr(transparent) stuff. Like the newer style in the windows-rs crate.

@lunabunn
Copy link
Contributor Author

Ah, right, those would be a breaking changes. In the meantime, I guess we are stuck with casting constants as necessary? (Or taking the module approach, as described in #2)

@lunabunn
Copy link
Contributor Author

The pub fields thing is technically also a breaking change, though, (AFAICT) and that's just broken w/o a workaround. Can that be merged, at least?

@Lokathor
Copy link
Owner

making the fields pub is allowed, you just can't make them private again after that. And if all fields are pub and then structure isn't non_exhaustive you can't add more fields (pub or priv).

But going from some amount of private to all public is legal.

@lunabunn
Copy link
Contributor Author

Ah, right, I'm only making private fields public not adding new fields. Got confused there.
With that out of the way, I rolled back the breaking changes, should be ready to merge.

@Lokathor Lokathor merged commit 4079f8a into Lokathor:master Jan 27, 2021
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