File: example2.rb

package info (click to toggle)
libinline-ruby 3.6.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 156 kB
  • ctags: 130
  • sloc: ruby: 1,197; makefile: 3
file content (29 lines) | stat: -rwxr-xr-x 382 bytes parent folder | download
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
#!/usr/local/bin/ruby17 -w

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)