Class: Inliner::Compilers::GCC

Inherits:
Compiler
  • Object
show all
Defined in:
lib/ffi-inliner/inliner.rb

Direct Known Subclasses

GPlusPlus

Instance Attribute Summary

Attributes inherited from Compiler

#progname

Instance Method Summary collapse

Methods inherited from Compiler

check_and_create, #compile, #initialize

Constructor Details

This class inherits a constructor from Inliner::Compilers::Compiler

Instance Method Details

#cmdObject


95
96
97
# File 'lib/ffi-inliner/inliner.rb', line 95

def cmd
  "#{ldshared} #{libs} -o \"#{@fm.so_fn}\" \"#{@fm.c_fn}\" 2>\"#{@fm.log_fn}\""
end

#exists?Boolean

Returns:

  • (Boolean)

85
86
87
# File 'lib/ffi-inliner/inliner.rb', line 85

def exists?
  IO.popen("#{@progname} 2>&1") { |f| f.gets } ? true : false
end

#ldsharedObject


88
89
90
91
92
93
94
# File 'lib/ffi-inliner/inliner.rb', line 88

def ldshared
  if Config::CONFIG['target_os'] =~ /darwin/
    'gcc -dynamic -bundle -fPIC'
  else
    'gcc -shared -fPIC'
  end
end