Skip to content

Commit

Permalink
Fix Issue remogatto#2: TCC generated shared libraries do not work in …
Browse files Browse the repository at this point in the history
…Windows
  • Loading branch information
Andrea Fazzi committed Nov 14, 2009
1 parent 52cf597 commit 0bb147b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,4 +3,5 @@
^#
pkg
announcement.txt
cache

6 changes: 5 additions & 1 deletion lib/ffi-inliner/inliner.rb
Expand Up @@ -112,7 +112,11 @@ def exists?
IO.popen("#{@progname}") { |f| f.gets } ? true : false
end
def cmd
"tcc -shared #{libs} -o \"#{@fm.so_fn}\" \"#{@fm.c_fn}\" 2>\"#{@fm.log_fn}\""
if Config::CONFIG['target_os'] =~ /mswin|mingw/
"tcc -rdynamic -shared #{libs} -o \"#{@fm.so_fn}\" \"#{@fm.c_fn}\" 2>\"#{@fm.log_fn}\""
else
"tcc -shared #{libs} -o \"#{@fm.so_fn}\" \"#{@fm.c_fn}\" 2>\"#{@fm.log_fn}\""
end
end
end
end
Expand Down
19 changes: 9 additions & 10 deletions spec/ffi-inliner/inliner_spec.rb
Expand Up @@ -159,16 +159,15 @@ module Foo
end
end
end
# it 'should use different compiler as specified in the configuration block' do
# tcc = mock('tcc', :exists? => true, :compile => nil)
# Inliner::Compilers::TCC.should_receive(:new).and_return(tcc)
# module Foo
# inline do |builder|
# builder.code = "int func_1() { return 0; }"
# builder.compiler = Inliner::Compilers::TCC
# end
# end
# end
it 'should use different compiler as specified in the configuration block' do
module Foo
inline do |builder|
builder.compiler Inliner::Compilers::TCC
builder.c "int func_1() { return 1 + 1; }"
end
end
Foo.func_1.should == 2
end

# it 'should be configured using the hash form' do
# tcc = mock('tcc', :exists? => true, :compile => nil)
Expand Down

0 comments on commit 0bb147b

Please sign in to comment.