Given an extern definition for printf:
static extern int printf(string format, int num);
on Windows, the following DllImport's are valid
This is not valid though:
On Mono, this fails with dll not found. Probably, Windows does a TrimEnd on the library name.
var attr = typeof(MainClass).GetMethod("printf", BindingFlags.Static | BindingFlags.NonPublic).GetCustomAttribute<DllImportAttribute>();
attr.Value includes the whitespace.
So the fix is in the library loading code.
This is the only member that supports trailing whitespace removal.