-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Variable arguments are all passed on the stack... This breaks interoperability with C
To Reproduce
Use a vargs
style holyc function and compile with hcc -S <file_name>
inspect the <file_name>.s
to see the assembly. The first argument to the function is RDI
that is argc
which is correct for our purposes. Thus if you were to call from C the first argument would have to be the number of arguments?
Example Program
I64 Something(...)
{
I64 acc = 0;
for (I64 i = 0; i < argc; ++i) {
acc += argv[i](I64);
}
return acc;
}
U0 Main()
{
"%d", Something(1,2,3,4,5);
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working