steveklabnik / ruby-sys Goto Github PK
View Code? Open in Web Editor NEWLow-level bindings to Ruby
Low-level bindings to Ruby
Originally d-unseductable/ruru#33.
Currently, creating a new ruby array segfaults.
extern crate ruby_sys;
use ruby_sys::array;
fn main() {
unsafe {
let foo = array::rb_ary_new();
}
}
Here's the result of cargo run --verbose
for anyone curious
Fresh libc v0.2.14
Fresh ruby-sys v0.2.6
Compiling test_ruru v0.1.0 (file:///Users/william/code/test_ruru)
Running `rustc src/main.rs --crate-name test_ruru --crate-type bin -g --out-dir /Users/william/code/test_ruru/target/debug --emit=dep-info,link -L dependency=/Users/william/code/test_ruru/target/debug -L dependency=/Users/william/code/test_ruru/target/debug/deps --extern ruby_sys=/Users/william/code/test_ruru/target/debug/deps/libruby_sys-6948a09fc5cf7b2c.rlib -L /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib`
src/main.rs:6:9: 6:12 warning: unused variable: `foo`, #[warn(unused_variables)] on by default
src/main.rs:6 let foo = array::rb_ary_new();
^~~
Running `target/debug/test_ruru`
error: Process didn't exit successfully: `target/debug/test_ruru` (signal: 11, SIGSEGV: invalid memory reference)
The latest version does not include the RUBY_STATIC changes, so we are relying on Github's master branch. Would it be possible for you to push a new version?
Building Ruby is pretty straightforward, and we could provide the option to do so if you didn't have the proper stuff installed already.
Consider using docs.rs instead of Travis + Github pages for documentation.
A Thermite user (on Windows) has multiple rubies installed but only the one in %PATH%
is getting built against. I suggest adding support for a RUBY
environment variable in build.rs
that defaults to ruby
(and then obviously document this in the README).
I can implement this once we decide this is the way we want to go.
There's some changes that need to be made to ruru to use 0.2.* (see https://github.com/malept/ruru/tree/ruby-sys-0-2).
if I do echo $RUBY_STATIC
in my environment, I get back 1
, so the env var is set, but ruby-sys
is still trying to link against libruby.so
. ldd target/release/mylib.so
shows the dynamic link to libruby.so
, so I tried moving the dynamic library somewhere that it won't be on the path and rebuilding. Now, Rust complains that /usr/bin/ld: cannot find -lruby
, which just shows what I thought was happening.
Looking at the build script, it seems to support the notion of linking against the Ruby library statically, but it doesn't seem to do that. Is this a working thing?
I'm on 64-bit Fedora 27.
I'm getting a silent failure running a native extension with Rust 1.13. My public external "init" function fires and returns, but none of its calls to Ruby (rb_define_module, rb_define_method) seem to have any effect. Not getting any errors either. Everything runs perfectly with Rust 1.12.1.
Hey Steve, great work! I've been looking at the various ruby-rust-ruby crates and what I can't find is documentation on using them.
Currently I'm looking to do something that may be somewhat simple as returning an Array from Rust to Ruby with FFI. I've opened an issue danielpclark/faster_path#6 to discuss that on my project.
Basically I'm not fully aware of what problems this project addresses. I don't see howtos or examples of it, or basic documentation. I'm thinking I'd like to use this crate, but I don't know where to begin.
As per the title, this appears to be missing from the list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.