How do I load a php library? I'm writing a wrapper module for a php library, and for some reason, can't get to actually doing something. When I try to call 

libraries_load($library_name);


I get an error message:

PHP Fatal error:  Call to undefined function libraries_load()


I do have set

dependencies[] = libraries (&gt;=2.x)


in the module_name.info file
and module_name_libraries_info() seems to be okay.
When I run drush libraries-list, I do get the library listed correctly.

The version of the libraries api I have installed is 7.x-2.2

How do I fix this?
It's very rare to need to use the Drupal API outside of a hook/callback function.

That's what's causing the problem in this case - your module file is simply being included before that of the libraries module, so the interpreter doesn't know what libraries_load() is yet.

I'd recommend moving your code into an appropriate function that gets invoked when Drupal is properly bootstrapped, and all enabled modules are loaded.

Failing that, you might get some joy out of tweaking the weight field in the system table for the modules in question. If your module has a higher weight than Libraries, you might be able to get it working. But moving the code to a more reliable place would arguably be better.