123456789_123456789_123456789_123456789_123456789_

Using three libraries

Passed an argument list of library names ffi_lib will try and load all the libraries or fail.

require 'ffi'

module MultiLibrary
  extend FFI::Library
  ffi_lib 'one', 'two', 'three'
end

Using one of three alternate libraries

Passed an array of library names ffi_lib will use the first library it successfully loads or fail if none can be loaded.

require 'ffi'

module NCurses
  extend FFI::Library
  ffi_lib ['ncurses', 'libncurses.so.5', 'XCurses']
end

Using three libraries and one of two alternate libraries

Unless libraries one, two, and three and one of either var1 or var2 can all be loaded the ffi_lib method will fail.

require 'ffi'

module MultiLibrary
  extend FFI::Library
  ffi_lib 'one', 'two', 'three', ['var1', 'var2']
end