Skip to content

Commit 9e3e86a

Browse files
author
Ryan Roden-Corrent
committed
Document use of Cdecl in binding to varargs.
This is the first binding to a varargs function that I could find in the library, so make it clear why this calling convention was used.
1 parent 674c87d commit 9e3e86a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

LibGit2Sharp/Core/NativeMethods.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,10 @@ internal static extern int git_filter_unregister(
584584
#region git_libgit2_opts
585585

586586
// Bindings for git_libgit2_opts(int option, ...):
587-
// Varargs can be bound using __arglist in .NET, but I had trouble getting that working with Mono.
588-
// Instead of using __arglist, I enumerate the possible signatures here.
589587
// Currently only GIT_OPT_GET_SEARCH_PATH and GIT_OPT_SET_SEARCH_PATH are supported,
590588
// but other overloads could be added using a similar pattern.
589+
// CallingConvention.Cdecl is used to allow binding the the C varargs signature, and each possible call signature must be enumerated.
590+
// __argslist was an option, but is an undocumented feature that should likely not be used here.
591591

592592
// git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH, int level, git_buf *buf)
593593
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]

0 commit comments

Comments
 (0)