[gme-users] Invoking a plug-in from an interpreter

Cinthya Lopez Cinthya_K_Lopez at raytheon.com
Wed Oct 17 13:43:36 CDT 2018


Hi All,

I am currently trying to invoke a plug-in from an interpreter. Does anyone have any experience on the best way to accomplish this?

I am writing both my interpreter and plug-in in C#. I currently have the following function in my interpreter.

        private void RunPlugIn(string filePath, MgaProject project)
        {
            MgaRegistrar mgaRegistrar = new MgaRegistrar();
            object obj = mgaRegistrar.get_AssociatedComponents(project.RootMeta.Name, componenttype_enum.COMPONENTTYPE_PLUGIN, regaccessmode_enum.REGACCESS_BOTH);
            Array plugins = (Array)obj;

            foreach (var pluginName in plugins)
            {
                if ((string)pluginName == "MGA.Interpreter.TestPlugIn")
                {
                    MgaLauncher mgaLauncher = new MgaLauncher();
                    if (mgaLauncher != null)
                    {
                        MgaFCO currentobj = null;
                        MgaFCOs selectedobjs = null;
                        mgaLauncher.RunComponent((string)pluginName, project, currentobj, selectedobjs, (int)ComponentStartMode.GME_EMBEDDED_START);
                        break;
                    }
                }
            }
        }

I can see the plug-in is found when calling get_AssociatedComponents () but I am getting an exception when calling mgaLauncher.RunComponent()

The exception reads: Exception from HRESULT: 0x87650036

It is my understanding that ComponentStartMode.GME_EMBEDDED_START is not really used by GME, but I am passing the startMode as such in hopes that it will help me identify when the plug-in is invoked by the interpreter. I am passing in currentobj and selectedobjs as NULL since I do not care about those (for now).

Any ideas what I may be doing wrong? Is this the recommended way to invoke a plug-in from an interpreter?

Thank you,
Cinthya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20181017/230f5da8/attachment.html>


More information about the gme-users mailing list