public class Processor
MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual,
CallingConventions.Standard,
targetMethod.ReturnType,
null,
new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) },
paramTypes,
null,
null);
methodBuilder.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
// bake it!
Type t = typeBuilder.CreateType();
return t;
}