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

Kevin Smyth kevin.m.smyth at gmail.com
Wed Oct 17 14:12:49 CDT 2018


Hi Cinthya,

I'm not sure what you're trying to accomplish here. Since you wrote the
plug-in, couldn't you just create it directly with new and call methods?


At any rate, that HRESULT is E_MGA_ALREADY_IN_TRANSACTION, which means your
plug-in is calling MgaProject.BeginTransaction, or your plug-in doesn't
implement IMgaComponentEx and MgaLauncher calls BeginTransaction for it.
The fix is to be sure you're implementing IMgaComponentEx and do not open
(or close) a transaction if project.ProjectStatus & 8 == 8.

Kevin

On Wed, Oct 17, 2018 at 1:43 PM Cinthya Lopez <Cinthya_K_Lopez at raytheon.com>
wrote:

> 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
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/gme-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20181017/c3be73cb/attachment.html>


More information about the gme-users mailing list