Skip to content

Latest commit

 

History

History

ruby_h_to_go

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ruby_h_to_go

Convert Ruby C function definition in ruby.h to Go source and dump to dist/.

Requirements

  • Ruby
  • Go
  • ctags
    • macOS: brew install universal-ctags
    • Ubuntu: apt-get install -y universal-ctags
  • goimports
    • go install golang.org/x/tools/cmd/goimports@latest

Usage

Output binding to /ruby/ using Ruby available in current context (recommended)

bundle exec rake ruby_h_to_go

Customize Ruby version to be used, output directory.

./exe/ruby_h_to_go
  • -H, --header-file : ruby header file. (default: "#{RbConfig::CONFIG["rubyhdrdir"]}/ruby.h")
  • -I, --include-path : include paths (default: [RbConfig::CONFIG["rubyarchhdrdir"], RbConfig::CONFIG["rubyhdrdir"]])
  • --dist-dir : dist dir for auto-generated Go code (default: ../../ruby/)
  • -t, --temp-file : temporary dist preprocessed ruby header file (default: "#{Dir.tmpdir}/ruby_preprocessed.h")