File: example2.rb

package info (click to toggle)
libinline-ruby 3.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 180 kB
  • ctags: 147
  • sloc: ruby: 1,467; makefile: 8
file content (34 lines) | stat: -rwxr-xr-x 444 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/local/bin/ruby17 -w

begin
  require 'rubygems'
rescue LoadError
  $: << 'lib'
end
require 'inline'

class MyTest

  inline do |builder|

    builder.add_compile_flags %q(-x c++)
    builder.add_link_flags %q(-lstdc++)

    builder.c "
// stupid c++ comment
#include <iostream>
/* stupid c comment */
static
void
hello(int i) {
  while (i-- > 0) {
    std::cout << \"hello\" << std::endl;
  }
}
"
  end
end

t = MyTest.new()

t.hello(3)