Module: GRX::CAPI
- Extended by:
- Fiddle::Importer
- Defined in:
- lib/grx/c_api.rb
Constant Summary collapse
- LIB_NAME =
case RUBY_PLATFORM when /mingw|mswin|windows/i then "grx_core.dll" when /darwin/i then "libgrx_core.dylib" else "libgrx_core.so" end
- RAKE_COMPILER_NAME =
rake-compiler siempre genera el archivo como “grx_core.so” / “grx_core.bundle” / “grx_core.dll” (sin el prefijo “lib”), y lo pone un nivel arriba de lib/grx/
case RUBY_PLATFORM when /mingw|mswin|windows/i then "grx_core.dll" when /darwin/i then "grx_core.bundle" else "grx_core.so" end
- LIB_PATHS =
[ # 1. make -C ext/unix → lib/grx/libgrx_core.so File.(LIB_NAME, __dir__), # 2. gem install (rake-compiler) → lib/grx_core.so (un nivel arriba) File.("../#{RAKE_COMPILER_NAME}", __dir__), # 3. gem install en Ruby versioned path → lib/ruby/X.X.X/grx_core.so File.("../../#{RAKE_COMPILER_NAME}", __dir__), # 4. desarrollo local sin instalar File.("../../ext/grx/#{LIB_NAME}", __dir__), ].freeze
- LOADED =
begin path = LIB_PATHS.find { |p| File.exist?(p) } raise Fiddle::DLError, "No se encontró #{LIB_NAME} en #{LIB_PATHS.inspect}" unless path dlload path true rescue Fiddle::DLError => e warn "[GRX] Extensión C no disponible: #{e.}\n" \ " → Ejecuta: make -C ext/unix install\n" \ " → Corriendo en modo Ruby puro (sin SIMD)." false end