Finding Plugins

These APIs allow you to find another plugin or yourself, or iterate across all plugins. For example, if you wrote an FMS plugin that needed to talk to an autopilot plugin, you could use these APIs to locate the autopilot plugin.


XPLMGetMyID

function

This routine returns the plugin ID of the calling plug-in. Call this to get your own ID.

XPLM_API XPLMPluginIDXPLMGetMyID(void);

XPLMCountPlugins

function

This routine returns the total number of plug-ins that are loaded, both disabled and enabled.

XPLM_API int        XPLMCountPlugins(void);

XPLMGetNthPlugin

function

This routine returns the ID of a plug-in by index. Index is 0 based from 0 to XPLMCountPlugins-1, inclusive. Plugins may be returned in any arbitrary order.

XPLM_API XPLMPluginIDXPLMGetNthPlugin(
                         int                  inIndex
                    );

XPLMFindPluginByPath

function

This routine returns the plug-in ID of the plug-in whose file exists at the passed in absolute file system path. XPLM_NO_PLUGIN_ID is returned if the path does not point to a currently loaded plug-in.

XPLM_API XPLMPluginIDXPLMFindPluginByPath(
                         const char *         inPath
                    );

XPLMFindPluginBySignature

function

This routine returns the plug-in ID of the plug-in whose signature matches what is passed in or XPLM_NO_PLUGIN_ID if no running plug-in has this signature. Signatures are the best way to identify another plug-in as they are independent of the file system path of a plug-in or the human-readable plug-in name, and should be unique for all plug-ins. Use this routine to locate another plugin that your plugin interoperates with

XPLM_API XPLMPluginIDXPLMFindPluginBySignature(
                         const char *         inSignature
                    );

XPLMGetPluginInfo

function

This routine returns information about a plug-in. Each parameter should be a pointer to a buffer of at least 256 characters, or NULL to not receive the information.

outName - the human-readable name of the plug-in. outFilePath - the absolute file path to the file that contains this plug-in. outSignature - a unique string that identifies this plug-in. outDescription - a human-readable description of this plug-in.

XPLM_API void       XPLMGetPluginInfo(
                         XPLMPluginID         inPlugin,
                         char *               outName,    /* Can be NULL */
                         char *               outFilePath,    /* Can be NULL */
                         char *               outSignature,    /* Can be NULL */
                         char *               outDescription    /* Can be NULL */
                    );