I was just trying to do some managed/unmanaged interop. To get extended error information I decided to register a log callback offered by the dll:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate void LogCallback(void* arg1,int level,byte* fmt);
This definition works, but i get strings like "Format %s probed with size=%d and score=%d". I tryed to add the __arglist keyword, but it is not allowed for delegates.
Well, it is not so dramatic for me, but I am just curious wether one could get the varargs parameters in C#. I know that I could use c++ for interop. So: Is there a way to do this purely in C#, with reasonable efford?
EDIT: For those who still did not get it: I am NOT IMPORTING a varargs function BUT EXPORTING it as a callback, which is then called my native code. I can specify only one at a time -> only one overload possible and __arglist does NOT work.