For example, commands and tools are registered by instantiating an MFnPlugin function set to operate on the MObject passed in. This MObject contains Maya private information such as the name of the plug-in file and the directory it was loaded from. It is passed in to the MFnPlugin constructor, along with the vendor name which defaults to "Unknown" if not specified, the version number of the plug-in as a string which defaults to "1.0", and the version of the API required for the plug-in to operate properly, which defaults to "Any".
Once constructed, the MFnPlugin function set is used to register the contents of the plug-in file. In the example ( ), the MFnPlugin::registerCommand() is called to register the "hello" command, along with the creator (see ) for the command. Once done, the function returns a status code indicating whether or not it succeeded. After an unsuccessful initialization, the plug-in is unloaded automatically.