-
Notifications
You must be signed in to change notification settings - Fork 0
Using Multiple and Alternate Libraries
stepheneb edited this page Sep 13, 2010
·
7 revisions
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
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
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