Use a 3rd part library when uninstalling a module my module uses several third part PHP libraries, loaded by using the library module supported by the x_autoload (several third part libraries are based on composer, so this support directly pointing to the composer file).

Just to provide you with an example:

function mymodule_libraries_info() {
  $libraries = array();
  ...
  $libraries['mongo-php-library'] = array(
      'name' =&gt; 'mongo-php-library',
      'vendor url' =&gt; 'https://github.com/mongodb/mongo-php-library',
      'download url' =&gt; 'https://github.com/mongodb/mongo-php-library/releases',
      'path' =&gt; 'src',
      'version arguments' =&gt; array(
          'file' =&gt; 'RELEASE-1.0',
          'pattern' =&gt; '/RELEASE (\d+\.\d+\.\d+).*/',
          'lines' =&gt; 1,
      ),
      'versions' =&gt; array("1.0.4"=&gt;array()),
      'xautoload' =&gt; function($adapter) {
        $adapter-&gt;composerJson('composer.json');
      },
  );
  ...
  return $libraries;
}


Everithing works fine (I can use this library in my working code) except for the "uninstall" part.

In fact, I need that the hook_uninstall() can access to this library in order to perform several operations, but I receive a WD php: Error: Class 'MongoDB\Client' not found error.

I guess this is related to a specific problem: when I try to uninstall the module, it has already been disabled, so its libraries are no loger available when I call the "uninstall".

How can I deal with this problem?
Not knowing what "operations" you are performing with this composer lib, I suggest you might want to just think of when you actually want to perform these operations. Doing it on Uninstall seems like a bad idea. Why not utilize hook_disable, instead of hook_uninstall, which should allow you to do things just before the module gets disabled.

If you really want to do it in a hook_uninstall, then you can load your .module file using drupal_load() and call the functions in your .module file from hook_uninstall.