Skip to content

builtin: call the C function wrappers instead of the C functions directly#26737

Merged
JalonSolov merged 1 commit into
vlang:masterfrom
kimshrier:add-builtin-cfns-wrapper-calls
Mar 17, 2026
Merged

builtin: call the C function wrappers instead of the C functions directly#26737
JalonSolov merged 1 commit into
vlang:masterfrom
kimshrier:add-builtin-cfns-wrapper-calls

Conversation

@kimshrier

Copy link
Copy Markdown
Contributor

builtin/array.v and builtin/map.v were calling C functions directly from a .v file which is now not allowed.

This converts those calls to using the wrapper functions in builtin/cfns_wrapper.c.v.

@tankf33der

Copy link
Copy Markdown
Contributor

@kimshrier - this code works on master. What happened and what didn't work that made you come up with creating this PR?

fn main() {
	mut a := []int{len: 8,init: index}
	a[2] = 100

	b := a.sorted_with_compare(|x, y| *x - *y)
	println(b)
}

@JalonSolov

JalonSolov commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

V has a special check for C. routines in plain .v files. Those files either have to be renamed to .c.v, or V equivalent routines/wrappers need to replace the C. routines.

The plan has been to make including C. stuff in plain .v files an error.

@JalonSolov JalonSolov merged commit 31af0e5 into vlang:master Mar 17, 2026
92 of 96 checks passed
@kimshrier kimshrier deleted the add-builtin-cfns-wrapper-calls branch April 28, 2026 02:04
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.

3 participants