You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a C type declaration is declared in the same module as you are running with v run ., you may cast a value to that C type. However, when the same type is declared in an external module and you import that module, you get
Initialize a brand new project with v init
Create a new main.c.v file with the contents:
modulemaintype C.TEST=int
Now edit main.v to use the type
modulemainfnmain() {
println(C.TEST(0))
}
Notice that this works exactly as intended.
Now create a new folder ./mymodule and v init inside. Then move main.c.v from the parent module to mymodule, rename it to mod.c.v and replace the contents with:
modulemymodulepubtype C.TEST=int
Rename mymodule/main.v to mymodule/mod.v, then change mymodule/mod.v to only contain
modulemymodule
Expected Behavior
Instead of an error saying "unknown function", casting should just work like locally declared C types
Describe the bug
When a C type declaration is declared in the same module as you are running with
v run ., you may cast a value to that C type. However, when the same type is declared in an external module and you import that module, you getReproduction Steps
Initialize a brand new project with
v initCreate a new
main.c.vfile with the contents:Now edit
main.vto use the typeNotice that this works exactly as intended.
Now create a new folder
./mymoduleandv initinside. Then movemain.c.vfrom the parent module to mymodule, rename it tomod.c.vand replace the contents with:Rename
mymodule/main.vtomymodule/mod.v, then changemymodule/mod.vto only containExpected Behavior
Instead of an error saying "unknown function", casting should just work like locally declared C types
Current Behavior
Compilation fails with error
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.12 21a0f11
Environment details (OS name and version, etc.)
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.