Created attachment 25047 [details]
native so with 65537 exported functions and dotnet that imports them and try to call latest
Its impossible to call 65536 imported function and above. Works fine on .Net Framework 4.
Platform: Ubuntu 16. Can reproduce on master and 22.214.171.124.
I created the minimal example to reproduce the bug. big_dllexport.c gives the native library with 65537 exported functions. Each of the function prints a unique number. dllimport.cs imports them all and calls ExportedFunc65537 function, which suppose to print 65537, but instead you get 1.
The attached archive contains three files. build.sh describes how to compile both native so and mono app. Run ./dllimport after compilation to see the unexpected output.
Fixed by mono master 9369ed6e23ee9e822a3aa2318ed55f083241fbcb.