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



99
100
101
102
103
104
105
# File 'lib/ffi-inliner/inliner.rb', line 99

def cmd
  if Config::CONFIG['target_os'] =~ /mswin|mingw/
    "sh -c ' #{ldshared} -o \"#{@fm.so_fn}\" \"#{@fm.c_fn}\" #{libs}' 2>\"#{@fm.log_fn}\""
  else
    "#{ldshared} #{libs} -o \"#{@fm.so_fn}\" \"#{@fm.c_fn}\" #{after_libs} 2>\"#{@fm.log_fn}\""
  end
end

#exists?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/ffi-inliner/inliner.rb', line 87

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

#ldsharedObject



91
92
93
94
95
96
97
# File 'lib/ffi-inliner/inliner.rb', line 91

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