Skip to content

Instantly share code, notes, and snippets.

@miyohide
Created September 27, 2017 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyohide/03f53094f4be80d26ff32a8216da74be to your computer and use it in GitHub Desktop.
Save miyohide/03f53094f4be80d26ff32a8216da74be to your computer and use it in GitHub Desktop.
mruby C lang output sample.
[~/work/mruby-1.3.0]$ cat hello_mruby_world.rb [2.3.3]
100.times do
puts 'Hello mruby World!'
end
[~/work/mruby-1.3.0]$ bin/mrbc -B out hello_mruby_world.rb [2.3.3]
[~/work/mruby-1.3.0]$ cat hello_mruby_world.c [2.3.3]
/* dumped in little endian order.
use `mrbc -E` option for big endian CPU. */
#include <stdint.h>
extern const uint8_t out[];
const uint8_t
#if defined __GNUC__
__attribute__((aligned(4)))
#elif defined _MSC_VER
__declspec(align(4))
#endif
out[] = {
0x45,0x54,0x49,0x52,0x30,0x30,0x30,0x34,0xc5,0x77,0x00,0x00,0x00,0x9c,0x4d,0x41,
0x54,0x5a,0x30,0x30,0x30,0x30,0x49,0x52,0x45,0x50,0x00,0x00,0x00,0x7e,0x30,0x30,
0x30,0x30,0x00,0x00,0x00,0x32,0x00,0x01,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x04,
0x83,0x31,0xc0,0x00,0x40,0x01,0x00,0x01,0x21,0x00,0x80,0x00,0x4a,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x05,0x74,0x69,0x6d,0x65,0x73,0x00,
0x00,0x00,0x00,0x46,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,
0x06,0x00,0x80,0x00,0x3d,0x00,0x00,0x01,0xa0,0x00,0x80,0x00,0x29,0x00,0x80,0x00,
0x00,0x00,0x00,0x01,0x00,0x00,0x12,0x48,0x65,0x6c,0x6c,0x6f,0x20,0x6d,0x72,0x75,
0x62,0x79,0x20,0x57,0x6f,0x72,0x6c,0x64,0x21,0x00,0x00,0x00,0x01,0x00,0x04,0x70,
0x75,0x74,0x73,0x00,0x45,0x4e,0x44,0x00,0x00,0x00,0x00,0x08,
};
[~/work/mruby-1.3.0]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment