Beispiel #1
0
        private unsafe static void InvokeInternal(ContextType *cxt, ulong nativeIdentifier, IScriptHost scriptHost)
        {
            cxt->nativeIdentifier = nativeIdentifier;

            unsafe
            {
#if !USE_HYPERDRIVE
                scriptHost.InvokeNative(new IntPtr(cxt));
#else
                if (!ms_invokers.TryGetValue(nativeIdentifier, out CallFunc invoker))
                {
                    invoker = BuildFunction(nativeIdentifier, GetNative(nativeIdentifier));
                    ms_invokers.Add(nativeIdentifier, invoker);
                }

                cxt->functionDataPtr = &cxt->functionData[0];
                cxt->retDataPtr      = &cxt->functionData[0];

                if (!invoker(cxt))
                {
                    throw new Exception("Native invocation failed.");
                }

                CopyReferencedParametersOut(cxt);
#endif
            }
        }
Beispiel #2
0
 private void InvokeNativeInternal(ref fxScriptContext context)
 {
     unsafe
     {
         fixed(fxScriptContext *cxt = &context)
         {
             m_host.InvokeNative(new IntPtr(cxt));
         }
     }
 }
Beispiel #3
0
        private void InvokeInternal(ulong nativeIdentifier, IScriptHost scriptHost)
        {
            m_context.nativeIdentifier = nativeIdentifier;

            unsafe
            {
                fixed(fxScriptContext *cxt = &m_context)
                {
                    scriptHost.InvokeNative(new IntPtr(cxt));
                }
            }
        }
Beispiel #4
0
        private unsafe static void InvokeInternal(ContextType *cxt, ulong nativeIdentifier, IScriptHost scriptHost)
        {
            cxt->nativeIdentifier = nativeIdentifier;

            unsafe
            {
#if !USE_HYPERDRIVE
                try
                {
                    scriptHost.InvokeNative(new IntPtr(cxt));
                }
                catch (ArgumentException e)
                {
                    IntPtr errorString = scriptHost.GetLastErrorText();
                    byte * error       = (byte *)errorString.ToPointer();

                    throw new InvalidOperationException(ErrorHandler(error));
                }
#else
                if (!ms_invokers.TryGetValue(nativeIdentifier, out CallFunc invoker))
                {
                    invoker = BuildFunction(nativeIdentifier, GetNative(nativeIdentifier));
                    ms_invokers.Add(nativeIdentifier, invoker);
                }

                cxt->functionDataPtr = &cxt->functionData[0];
                cxt->retDataPtr      = &cxt->functionData[0];

                byte *error = null;

                if (!invoker(cxt, (void **)&error))
                {
                    throw new InvalidOperationException(ErrorHandler(error));
                }

                CopyReferencedParametersOut(cxt);
#endif
            }
        }
Beispiel #5
0
        private unsafe static void InvokeInternal(ContextType *cxt, ulong nativeIdentifier, IScriptHost scriptHost)
        {
            cxt->nativeIdentifier = nativeIdentifier;

            unsafe
            {
#if !USE_HYPERDRIVE
                scriptHost.InvokeNative(new IntPtr(cxt));
#else
                if (!ms_invokers.TryGetValue(nativeIdentifier, out CallFunc invoker))
                {
                    invoker = BuildFunction(GetNative(nativeIdentifier));
                    ms_invokers.Add(nativeIdentifier, invoker);
                }

                cxt->functionDataPtr = &cxt->functionData[0];
                cxt->retDataPtr      = &cxt->functionData[0];

                invoker(cxt);
#endif
            }
        }
 public void InvokeNative(ref fxScriptContext context)
 {
     m_host.InvokeNative(context);
 }
Beispiel #7
0
 public void InvokeNative([MarshalAs(UnmanagedType.Struct)] IntPtr context)
 {
     m_realHost.InvokeNative(context);
 }
Beispiel #8
0
 public void InvokeNative([MarshalAs(UnmanagedType.Struct)] ref fxScriptContext context)
 {
     m_realHost.InvokeNative(ref context);
 }
Beispiel #9
0
        private unsafe void InvokeInternal(ulong nativeIdentifier, IScriptHost scriptHost)
        {
            m_context.nativeIdentifier = nativeIdentifier;

            scriptHost.InvokeNative(ref m_context);
        }