コード例 #1
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
            }
        }
コード例 #2
0
ファイル: MonoScriptRuntime.cs プロジェクト: jaymo1011/fivem
 public IntPtr GetLastErrorText()
 {
     return(m_realHost.GetLastErrorText());
 }