private static Type[] GetParameterTypes(object[] parameters) { Type[] marshalType = new Type[(int)parameters.Length]; for (int i = 0; i < (int)parameters.Length; i++) { marshalType[i] = CdeclFunction.GetMarshalType(parameters[i].GetType()); } return(marshalType); }
static XPrintfFunctions() { CdeclFunction cdeclFunction = new CdeclFunction("msvcrt", "printf", typeof(int)); XPrintfFunctions.printf = new XPrintfFunctions.XPrintf(cdeclFunction.Invoke); CdeclFunction cdeclFunction1 = new CdeclFunction("msvcrt", "fprintf", typeof(int)); XPrintfFunctions.fprintf = new XPrintfFunctions.XPrintf(cdeclFunction1.Invoke); CdeclFunction cdeclFunction2 = new CdeclFunction("MonoPosixHelper", "Mono_Posix_Stdlib_snprintf", typeof(int)); XPrintfFunctions.snprintf = new XPrintfFunctions.XPrintf(cdeclFunction2.Invoke); CdeclFunction cdeclFunction3 = new CdeclFunction("MonoPosixHelper", "Mono_Posix_Stdlib_syslog2", typeof(int)); XPrintfFunctions.syslog = new XPrintfFunctions.XPrintf(cdeclFunction3.Invoke); }
static XPrintfFunctions() { CdeclFunction _printf = new CdeclFunction(Stdlib.LIBC, "printf", typeof(int)); printf = new XPrintf(_printf.Invoke); CdeclFunction _fprintf = new CdeclFunction(Stdlib.LIBC, "fprintf", typeof(int)); fprintf = new XPrintf(_fprintf.Invoke); CdeclFunction _snprintf = new CdeclFunction(Stdlib.MPH, "Mono_Posix_Stdlib_snprintf", typeof(int)); snprintf = new XPrintf(_snprintf.Invoke); CdeclFunction _syslog = new CdeclFunction(Syscall.MPH, "Mono_Posix_Stdlib_syslog2", typeof(int)); syslog = new XPrintf(_syslog.Invoke); }
public object Invoke(object[] parameters) { Type[] parameterTypes = CdeclFunction.GetParameterTypes(parameters); return(this.CreateMethod(parameterTypes).Invoke(null, parameters)); }