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

C interop variable/keyword conflict #22570

Closed
duarteroso opened this issue Oct 18, 2024 · 2 comments
Closed

C interop variable/keyword conflict #22570

duarteroso opened this issue Oct 18, 2024 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@duarteroso
Copy link
Contributor

duarteroso commented Oct 18, 2024

Describe the bug

While binding raylib into V, I came across a conflict between a variable name and a reserved keyword in V.
Is there a way around this?

Reproduction Steps

typedef struct AutomationEvent {
    unsigned int frame;             
    unsigned int type;           
    int params[4];               
} AutomationEvent;
@[typedef]
struct C.AutomationEvent {
	frame u32
	type u32 // error: unexpected keyword `type`, expecting name
	params [4]int
}

Expected Behavior

A way around the conflict, ideally.

Current Behavior

Compilation error.

Possible Solution

Perhaps like the JSON attribute @[name: 'c_name']?

Additional Information/Context

No response

V version

0.4.8

Environment details (OS name and version, etc.)

% v doctor
V full version: V 0.4.8 2ab1523
OS: macos, macOS, 14.7, 23H124
Processor: 16 cpus, 64bit, little endian, Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz

getwd: /Users/duarteroso
vexe: /usr/local/Cellar/vlang/0.4.8/libexec/v
vexe mtime: 2024-09-28 15:50:00

vroot: OK, value: /usr/local/Cellar/vlang/0.4.8/libexec
VMODULES: OK, value: /Users/duarteroso/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.33.0
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present: false

CC version: Apple clang version 15.0.0 (clang-1500.3.9.4)
thirdparty/tcc: N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@duarteroso duarteroso added the Bug This tag is applied to issues which reports bugs. label Oct 18, 2024
@felipensp
Copy link
Member

Recently this keyword issue was fixed. On master it works using type as name, on old versions you must use @type.

@duarteroso
Copy link
Contributor Author

My bad!
Brew isn't doesn't seem to be on latest...

Thnaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants