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

Possible for --with-attribute to allow for multiple = in args? #469

Closed
kkukshtel opened this issue Sep 13, 2023 · 4 comments
Closed

Possible for --with-attribute to allow for multiple = in args? #469

kkukshtel opened this issue Sep 13, 2023 · 4 comments

Comments

@kkukshtel
Copy link
Contributor

Hello! Trying to annotate some output functions with an additional attribute, specifically:
UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })
or something similar.

However, no matter what I try to pass to --with-attribute this either doesn't work because the program expects a key/value(?) or it generates the proper bindings but there is no attribute output. I also looked into the TerraFX interop rsp examples where you bind to Flags but I'm still unclear on what that's doing/why attributes need a key/value configuration when I assume they should just be copy-pasted strings, as well as what the key/value would be in my case.

@kkukshtel
Copy link
Contributor Author

kkukshtel commented Sep 13, 2023

Right after typing this I figured out that the key is meant to be what you are binding the attribute to, and the value is the actual attribute. However I'm still running into issues because I have the constructor for the attribute that needs to be passed in for the array. I think it's a parsing issue re this:

Other ways to get around it could be positional params, but the ctor for the attribute has no params so you have to do a field assignment inline.

I understand why you want to bail on more than 2 =, maybe you (or I) could add something like --with-attribute-raw that allows for just grabbing whatever is after the first equals?

@kkukshtel kkukshtel changed the title Unclear how --with-attribute is meant to work Possible for --with-attribute to allow for multiple = in args? Sep 14, 2023
@tannergooding
Copy link
Member

I'm fine with a contribution that changes this to split on the first = rather than only require one =

@kkukshtel
Copy link
Contributor Author

Sounds great, made a PR here:

#471

tannergooding added a commit that referenced this issue Sep 19, 2023
Allow equals sign in value for parsed KVP Pairs
@tannergooding
Copy link
Member

Resolved with #471

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

No branches or pull requests

2 participants