0

I am learning mruby and one of the arguments in favor of it I am reading everywhere is that it is

easily embeddable

I have seen some code where C and mruby is mixed. But I am not very clear about what exactly is embeddable language, and what are its advantages? For example I can write everything in C so what does mruby brings into my C application? And why would I like to make this mixture or embedded?

Kindly help me understand with a simple example, here is a sample mruby code embedded into a c code:

#include <stdlib.h>
#include <stdio.h>

#include <mruby.h>
#include <mruby/compile.h>

int main(void)  
{
  mrb_state *mrb = mrb_open();
  char code[] = "5.times { puts 'Ruby is awesome!' }";

  mrb_load_string(mrb, code);
  return 0;
}

I am also confusing with embedded systems language and embedded language.

Kindly help me understand this.

0 Answers0