Questions tagged [mruby]

mruby is the lightweight implementation of the Ruby language, that can compile to C source; it's intended to make Ruby constructs accessible for embedded systems development.

mruby is the lightweight implementation of the Ruby language complying to (part of) the ISO standard. mruby can be linked and embedded within your application. We provide the interpreter program "mruby" and the interactive mruby shell "mirb" as examples. You can also compile Ruby programs into compiled byte code using the mruby compiler "mrbc". All those tools reside in "bin" directory. The "mrbc" is also able to generate compiled byte code in a C source file. You can check the "mrbtest" program under the "test" directory.

37 questions
2
votes
1 answer

The difference of mruby and embedding Python in C program

In mruby, we can embed the ruby code in a C program. We can also do this in Python. Is there any difference in the principle of these two?
ming.kernel
  • 3,365
  • 3
  • 21
  • 32
1
vote
1 answer

How does const_get work in mruby?

I use mruby 1.3.0 (2017-7-4) with build_config.rb: MRuby::Build.new do |conf| if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] toolchain :visualcpp else toolchain :gcc end enable_debug conf.gembox 'default' conf.gem :git =>…
naughie
  • 315
  • 2
  • 14
1
vote
0 answers

Cannot install ngx_mruby on Centos 7

I want to install nginx with the module ngx_mruby on centos7, but I ran into the compilation errors. Following the steps described here, I did (in my home directory): wget http://nginx.org/download/nginx-1.10.1.tar.gz tar zxvf…
naughie
  • 315
  • 2
  • 14
1
vote
1 answer

MRB_THROW causes error in libc++abi.dylib

I'm trying to build a modified version of ios-ruby-embedded project with some extra gems, including the mruby-marshal gem from the mruby-mgems list (which includes a .cpp file). I can get it to build and run, but if I raise any exception the app…
WaveformDelta
  • 141
  • 1
  • 8
1
vote
1 answer

mruby: How to execute shell commands?

In mruby how can I run shell commands with %x(), `` or system? Is there an mgem I can use for it?
1
vote
1 answer

Minimal static compilation in mruby

I have a simple example: #include "mruby.h" #include int main() { mrb_int i; mrb_value c; mrb_state *mrb = mrb_open(); char kod[] = "def suma(a,b) (a+b).to_i end"; if (!mrb) { /* problemy */ } …
Eliasz Łukasz
  • 478
  • 1
  • 3
  • 17
1
vote
2 answers

How to include mruby after installing with rbenv/ruby-build?

I'm trying to compile the "Source Code (.c)" example from this tutorial. I have installed mruby using rbenv: rbenv install mruby-1.2.0 I get an error when trying to compile the program: $ gcc -std=c99 -Imruby/include test_program.c -o…
Andrew
  • 227,796
  • 193
  • 515
  • 708
1
vote
1 answer

Do I need to recompile a C-mruby application after making chnages in mruby script file?

I have a C application. The C application needs a few script files containing mruby code. Is it possible to run this application using current mruby implementation without recompilation (after I make any change in mruby scripts) ? If yes how…
1
vote
1 answer

calling mruby VM in C++

I am trying to convert some of the ruby interpreter code called in C to mruby format. I am stuck and would appreciate help here. My testruby.rb file content: #require 'MyMod' def helloworld(var1) puts "You said #{var1}" return…
programmer
  • 582
  • 2
  • 4
  • 16
1
vote
3 answers

Compiling mruby

I am trying to compile mruby. This is my first time compiling something from command line. When I run make on the directory, I get this: make -C mrblib --no-print-directory CC=gcc LL=gcc make -C ../tools/mrbc --no-print-directory CC=gcc LL=gcc gcc…
0xSina
  • 20,973
  • 34
  • 136
  • 253
0
votes
0 answers

Can I write a gui app with `mruby` as `lua`?

It's confused that i couldn't find api about gui with mruby when i viewing the official web of mruby. I writed gui app with ruby, but it lacks a good packaging way to run .exe on WinOS.ocra perform bad on ruby3, ruby-packer lacks option to add dll…
Cegazhos
  • 33
  • 3
0
votes
0 answers

Calling Mruby library functions in Crystal segfaults on MSVC environment

I am currently working on a way to bind an Mruby interpreter to Crystal projects. However, my current code segfaults on Windows (while running perfectly on WSL Ubuntu) with the 64bit Visual Studio environment and I do not find a solution for the…
0
votes
2 answers

Calling a C function from mruby

Does mruby have the same FFI functions as Ruby? How do I call a C function from mruby? I am asking because I am considering the H20 web server with mruby scripting, but I need to be able to call c functions or programs from the mruby script.
iamoumuamua
  • 351
  • 2
  • 11
0
votes
0 answers

Non-blocking $stdin.gets() in MRuby (not MRI)

I am writing an application that requires non-blocking reads of $stdin. Normally (if I were using Ruby rather than mRuby) I would accomplish this via the Thread and Queue class. Unfortunately, mRuby does not provide these natively and it appears…
Rick
  • 8,366
  • 8
  • 47
  • 76
0
votes
1 answer

mruby equivalent of begin ... end until

I'm trying to port a ruby code base to mruby. In ruby (MRI), I can do (and unfortunately, the person who wrote it did) begin statement end until condition which executes statement once until and then until condition becomes positive. In mruby,…
pulsejet
  • 1,101
  • 13
  • 27