Example #1
0
        internal static ThunkInfo GetThunk(MethodInfo method, string funcType = null)
        {
            Type dt;

            if (funcType != null)
            {
                dt = typeof(Interop).GetNestedType(funcType) as Type;
            }
            else
            {
                dt = GetPrototype(method.Name);
            }

            if (dt == null)
            {
                return(ThunkInfo.Empty);
            }
            Delegate d    = Delegate.CreateDelegate(dt, method);
            var      info = new ThunkInfo(d);

            return(info);
        }
Example #2
0
        internal static ThunkInfo GetThunk(MethodInfo method, string funcType = null)
        {
            Type dt;

            if (funcType != null)
            {
                dt = typeof(Interop).GetNestedType(funcType) as Type;
            }
            else
            {
                dt = GetPrototype(method.Name);
            }

            if (dt == null)
            {
                return(ThunkInfo.Empty);
            }
            Delegate d    = Delegate.CreateDelegate(dt, method);
            var      info = new ThunkInfo(d);

            // TODO: remove keepAlive when #958 merged, let the lifecycle of ThunkInfo transfer to caller.
            keepAlive.Add(info);
            return(info);
        }
Example #3
0
 public void KeeapAlive(ThunkInfo thunk)
 {
     _keepalive.Add(thunk);
 }
Example #4
0
 public void Set(int offset, ThunkInfo thunk)
 {
     _slots[offset] = thunk;
 }