Skip to content

[zerolib] Pinvoke and functions with Variable Arguments #157

Closed Answered by MichalStrehovsky
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

params is not equivalent to vararg. You'd need to use the undocumented __arglist keyword. But that one doesn't work with native AOT in general.

You can just declare a p/invoke for each signature shape you need:

[DllImport(...)]
int printf(byte* format, int intArg1);

[DllImport(...)]
int printf(byte* format, int intArg1, int intarg2);

[DllImport(...)]
int printf(byte* format, int intArg, int intArg2, int intarg3);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant