Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
searching a bunch of places before giving up
- Loading branch information
1 parent
ee1e129
commit c0b60d4
Showing
1 changed file
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,7 +1,21 @@ | |||
require 'dl/import' | require 'dl/import' | ||
module EarwormLib # :nodoc: | module EarwormLib # :nodoc: | ||
extend DL::Importable | extend DL::Importable | ||
dlload('/opt/local/lib/libofa.dylib') | loaded = false | ||
libs = %w{ libofa.dylib libofa.so libofa.so.0 } | |||
dirs = %w{ /opt/local/lib /usr/local/lib } | |||
libs += libs.map { |lib| dirs.map { |dir| File.join(dir, lib) } }.flatten | |||
libs.each do |so| | |||
begin | |||
dlload(so) | |||
loaded = true | |||
break | |||
rescue | |||
next | |||
end | |||
end | |||
raise "Please install libofa" unless loaded | |||
|
|||
extern "void ofa_get_version(int *, int *, int *)" | extern "void ofa_get_version(int *, int *, int *)" | ||
extern "const char * ofa_create_print(const char *, int, long, int, int)" | extern "const char * ofa_create_print(const char *, int, long, int, int)" | ||
end | end |