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

standalone_sys should support string constants #2499

Open
Jake-Shadle opened this issue May 10, 2023 · 2 comments
Open

standalone_sys should support string constants #2499

Jake-Shadle opened this issue May 10, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Jake-Shadle
Copy link
Contributor

Which crate is this about?

windows-bindgen

Crate version

0.49.0

Summary

When binding string constants there are 2 issues.

  1. String constants are Type::String, which gets resolved to HSTRING, and while it's unlikely, if you don't bind another item that pulls in PCSTR or PCWSTR (the string types that Type::String constants actually get resolved to) then there will be a missing typedef.
  2. String constants unconditionally assume that the s! and w! macros are available.

Toolchain version/configuration

No response

Reproducible example

No response

Crate manifest

No response

Expected behavior

The emitted string constants should compile correctly.

Actual behavior

The emitted constants will fail to compile due to the unknown s! or w! macro(s), and possibly due to missing the type aliases for PCSTR and/or PCWSTR.

Additional comments

No response

@Jake-Shadle Jake-Shadle added the bug Something isn't working label May 10, 2023
@kennykerr
Copy link
Collaborator

String constants are Type::String, which gets resolved to HSTRING,

That's not the case.

String constants unconditionally assume that the s! and w! macros are available.

Note that this only affects standalone_sys where standalone_win assumes a dependency on the windows-core crate and works fine.

@kennykerr
Copy link
Collaborator

I take that back - this changed somewhere along the way. The metadata should only use System.String for HSTRING types. 🙄

@kennykerr kennykerr changed the title Bug: String constants emittted incorrectly standalone_sys should support string constants May 11, 2023
@kennykerr kennykerr added enhancement New feature or request and removed bug Something isn't working labels May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants