{ array.c }
procedure rb_mem_clear(mem: Pvalue; size: Integer); cdecl; external RubyDLL;
function rb_assoc_new(car, cdr: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_new: Tvalue; cdecl; external RubyDLL;
function rb_ary_new2(len: Integer): Tvalue; cdecl; external RubyDLL;
//function rb_ary_new3(long,...): Tvalue;
function rb_ary_new4(n: Integer; elts: Pvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_freeze(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_aref(argc: Integer; argv: Pvalue; ary: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_ary_store(ary: Tvalue; idx: Integer; val: Tvalue); cdecl; external RubyDLL;
function rb_ary_to_s(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_push(ary, item: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_pop(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_shift(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_unshift(ary, item: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_entry(ary: Tvalue; offset: Integer): Tvalue; cdecl; external RubyDLL;
function rb_ary_each(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_join(ary, sep: Tvalue): Tvalue; cdecl; external RubyDLL;
//function rb_ary_print_on(ary, f: Tvalue): Tvalue;
function rb_ary_reverse(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_sort(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_sort_bang(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_delete(ary, item: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_delete_at(ary: Tvalue; at: LongInt): Tvalue; cdecl; external RubyDLL;
function rb_ary_clear(ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_plus(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_concat(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_assoc(ary, key: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_rassoc(ary, value: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ary_includes(ary, item: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_protect_inspect(func: Pointer; obj, arg: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_inspecting_p(obj: Tvalue): Tvalue; cdecl; external RubyDLL;

{ bignum.c }
function rb_big_clone(x: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_big_2comp(x: Tvalue); cdecl; external RubyDLL;
function rb_big_norm(x: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_uint2big(n: Cardinal): Tvalue; cdecl; external RubyDLL;
function rb_int2big(n: Integer): Tvalue; cdecl; external RubyDLL;
function rb_uint2inum(n: Cardinal): Tvalue; cdecl; external RubyDLL;
function rb_int2inum(n: Integer): Tvalue; cdecl; external RubyDLL;
function rb_str2inum(const ptr: PChar; len: Integer): Tvalue; cdecl; external RubyDLL;
function rb_big2str(x: Tvalue; len: Integer): Tvalue; cdecl; external RubyDLL;
function rb_big2long(x: Tvalue): Integer; cdecl; external RubyDLL;
function rb_big2ulong(x: Tvalue): Cardinal; cdecl; external RubyDLL;
function rb_dbl2big(n: Double): Tvalue; cdecl; external RubyDLL;
function rb_big2dbl(x: Tvalue): Double; cdecl; external RubyDLL;
function rb_big_plus(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_minus(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_mul(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_pow(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_and(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_or(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_xor(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_lshift(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_big_rand(x: Tvalue; rand: Double): Tvalue; cdecl; external RubyDLL;

{ class.c }
function rb_class_new(super: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_singleton_class_new(super: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_singleton_class_clone(klass: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_singleton_class_attached(klass, obj: Tvalue); cdecl; external RubyDLL;
function rb_define_class_id(id: Tid; super: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_module_new: Tvalue; cdecl; external RubyDLL;
function rb_define_module_id(id: Tid): Tvalue; cdecl; external RubyDLL;
function rb_mod_included_modules(module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_mod_ancestors(module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_class_instance_methods(argc: Integer; argv: Pvalue; module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_class_protected_instance_methods(argc: Integer; argv: Pvalue; module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_class_private_instance_methods(argc: Integer; argv: Pvalue; module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_obj_singleton_methods(obj: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_define_method_id(klass: Tvalue; name: Tid; func: TFunc0; argc: Integer); cdecl; external RubyDLL;
procedure rb_define_protected_method(klass: Tvalue; const name: PChar; func: TFunc0; argc: Integer); cdecl; external RubyDLL;
procedure rb_define_private_method(klass: Tvalue; const name: PChar; func: TFunc0; argc: Integer); cdecl; external RubyDLL;
procedure rb_define_singleton_method(obj: Tvalue; const name: PChar; func: TFunc0; argc: Integer); cdecl; external RubyDLL;
function rb_singleton_class(obj: Tvalue): Tvalue; cdecl; external RubyDLL;

{ error.c }
function rb_exc_new(etype: Tvalue; const ptr: PChar; len: Integer): Tvalue; cdecl; external RubyDLL;
function rb_exc_new2(etype: Tvalue; const s: PChar): Tvalue; cdecl; external RubyDLL;
function rb_exc_new3(etype, str: Tvalue): Tvalue; cdecl; external RubyDLL;

{ eval.c }
procedure rb_exc_raise(mesg: Tvalue); cdecl; external RubyDLL;
procedure rb_exc_fatal(mesg: Tvalue); cdecl; external RubyDLL;
procedure rb_remove_method(klass: Tvalue; const name: PChar); cdecl; external RubyDLL;
procedure rb_disable_super(klass: Tvalue; const name: PChar); cdecl; external RubyDLL;
procedure rb_enable_super(klass: Tvalue; const name: PChar); cdecl; external RubyDLL;
{$IFDEF RUBY18}
procedure rb_define_alloc_func(klass: Tvalue; func: TAttr0); cdecl; external RubyDLL;
procedure rb_undef_alloc_func(klass: Tvalue); cdecl; external RubyDLL;
{$ENDIF}
procedure rb_clear_cache; cdecl; external RubyDLL;
procedure rb_alias(klass: Tvalue; name, def: Tid); cdecl; external RubyDLL;
procedure rb_attr(klass: Tvalue; id: Tid; read, write, ex: Integer); cdecl; external RubyDLL;
function rb_method_boundp(klass: Tvalue; id: Tid; ex: Integer): Integer; cdecl; external RubyDLL;
function rb_dvar_defined(id: Tid): Tvalue; cdecl; external RubyDLL;
function rb_dvar_ref(i: Tid): Tvalue; cdecl; external RubyDLL;
procedure rb_dvar_asgn(id: Tid; v: Tvalue); cdecl; external RubyDLL;
procedure rb_dvar_push(id: Tid; v: Tvalue); cdecl; external RubyDLL;
function rb_eval_cmd(cmd, arg: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_respond_to(obj: Tvalue; id: Tid): Integer; cdecl; external RubyDLL;
procedure rb_interrupt; cdecl; external RubyDLL;
function rb_apply(recv: Tvalue; mid: Tid; args: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_backtrace; cdecl; external RubyDLL;
{$IFDEF RUBY19}
function rb_frame_this_func: Tid; cdecl; external RubyDLL;
{$ELSE}
function rb_frame_last_func: Tid; cdecl; external RubyDLL;
{$ENDIF}
function rb_obj_instance_eval(argc: Integer; argv: Pvalue; This: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_set_end_proc(func: TFunc0; data: Tvalue); cdecl; external RubyDLL;
procedure rb_exec_end_proc; cdecl; external RubyDLL;
procedure rb_mark_end_proc; cdecl; external RubyDLL;
procedure rb_gc_mark_threads; cdecl; external RubyDLL;
procedure rb_thread_start_timer; cdecl; external RubyDLL;
procedure rb_thread_stop_timer; cdecl; external RubyDLL;
procedure rb_thread_schedule; cdecl; external RubyDLL;
procedure rb_thread_wait_fd(fd: Integer); cdecl; external RubyDLL;
function rb_thread_fd_writable(fd: Integer): Integer; cdecl; external RubyDLL;
procedure rb_thread_fd_close(fd: Integer); cdecl; external RubyDLL;
function rb_thread_alone: Integer; cdecl; external RubyDLL;
procedure rb_thread_sleep(time: Integer); cdecl; external RubyDLL;
procedure rb_thread_sleep_forever; cdecl; external RubyDLL;
function rb_thread_stop: Tvalue; cdecl; external RubyDLL;
function rb_thread_wakeup(thread: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_thread_run(thread: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_thread_create(fn: TFunc0; arg: Pointer): Tvalue; cdecl; external RubyDLL;
function rb_thread_scope_shared_p: Integer; cdecl; external RubyDLL;
procedure rb_thread_interrupt; cdecl; external RubyDLL;
procedure rb_thread_trap_eval(cmd: Tvalue; sig: Integer); cdecl; external RubyDLL;
procedure rb_thread_signal_raise(sig: PChar); cdecl; external RubyDLL;
function rb_thread_select: Integer; cdecl; external RubyDLL;
procedure rb_thread_wait_for; cdecl; external RubyDLL;
function rb_thread_current: Tvalue; cdecl; external RubyDLL;
function rb_thread_main: Tvalue; cdecl; external RubyDLL;
function rb_thread_local_aref(thread: Tvalue; id: Tid): Tvalue; cdecl; external RubyDLL;
function rb_thread_local_aset(thread: Tvalue; id: Tid; val: Tvalue): Tvalue; cdecl; external RubyDLL;

{ file.c }
function eaccess(const path: PChar; mode: Integer): Integer; cdecl; external RubyDLL;
function rb_file_s_expand_path(argc: Integer; argv: Pvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_file_const(const fname: PChar; v: Tvalue); cdecl; external RubyDLL;
function rb_find_file(fname :PChar): PChar; cdecl; external RubyDLL;

{ gc.c }
procedure rb_global_variable(val: Pvalue); cdecl; external RubyDLL;
procedure rb_gc_mark_locations(start, fin: Pvalue); cdecl; external RubyDLL;
//procedure rb_mark_tbl(Ptable);
//procedure rb_mark_hash(Ptable);
procedure rb_gc_mark_maybe(obj: Pointer); cdecl; external RubyDLL;
procedure rb_gc_mark(obj: Pointer); cdecl; external RubyDLL;
procedure rb_gc_force_recycle(p: Tvalue); cdecl; external RubyDLL;
procedure rb_gc; cdecl; external RubyDLL;
procedure rb_gc_call_finalizer_at_exit; cdecl; external RubyDLL;

{ hash.c }
function rb_hash(hash :Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_hash_new: Tvalue; cdecl; external RubyDLL;
function rb_hash_freeze(hash :Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_hash_aref(hash, key : Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_hash_aset(hash, key, val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_path_check(path: PChar): Integer; cdecl; external RubyDLL;
function rb_env_path_tainted: Integer; cdecl; external RubyDLL;

{ intern.h }
procedure rb_load(fname: Tvalue; wrap: Integer); cdecl; external RubyDLL;
procedure rb_load_protect(fname: Tvalue; wrap: Integer; var state: Integer); cdecl; external RubyDLL;
procedure rb_jump_tag(tag: Integer); cdecl; external RubyDLL;
procedure rb_provide(const feature: PChar); cdecl; external RubyDLL;
function rb_f_require(obj, fname: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_obj_call_init(obj: Tvalue; argc: Integer; argv: Pvalue); cdecl; external RubyDLL;
function rb_class_new_instance(argc: Integer; argv: Pvalue; klass: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_f_lambda: Tvalue; cdecl; external RubyDLL;
function rb_protect(proc: TGetValFunc; data: Tvalue; var state: Integer): Tvalue; cdecl; external RubyDLL;

function rb_id_attrset(id: Tid): Tid; cdecl; external RubyDLL;

{ io.c }
function rb_io_write(io, str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_io_gets(io: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_io_getc(io: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_io_ungetc(io, c: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_io_close(io: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_io_eof(io: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_io_binmode(io: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_file_open(const fname, mode: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_gets: Tvalue; cdecl; external RubyDLL;
procedure rb_str_setter(val: Tvalue; id: Tid; ptr: Pvalue); cdecl; external RubyDLL;
function rb_io_mode_flags(mode: PChar): Integer; cdecl; external RubyDLL;

{ numeric.c }
procedure rb_num_zerodiv; cdecl; external RubyDLL;
function rb_num_coerce_bin(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_float_new(d: Double): Tvalue; cdecl; external RubyDLL;
function rb_num2fix(val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_fix2str(x: Tvalue; base: Integer): Tvalue; cdecl; external RubyDLL;
function rb_fix_upto(from, too: Tvalue): Tvalue; cdecl; external RubyDLL;

{ object.c }
function rb_inspect(obj: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_obj_is_instance_of(obj, c: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_obj_is_kind_of(obj, c: Tvalue): Tvalue; cdecl; external RubyDLL;

{ parse.c }
function yyparse: Integer; cdecl; external RubyDLL;
procedure rb_parser_append_print; cdecl; external RubyDLL;
procedure rb_parser_while_loop(chop, split: Integer); cdecl; external RubyDLL;
function rb_is_const_id(id: Tid): Integer; cdecl; external RubyDLL;
function rb_is_instance_id(id: Tid): Integer; cdecl; external RubyDLL;
function rb_backref_get: Tvalue; cdecl; external RubyDLL;
procedure rb_backref_set(val: Tvalue); cdecl; external RubyDLL;
function rb_lastline_get: Tvalue; cdecl; external RubyDLL;
procedure rb_lastline_set(val: Tvalue); cdecl; external RubyDLL;

{ process.c }
function rb_proc_exec(const str: PChar): Integer; cdecl; external RubyDLL;
procedure rb_syswait(pid: Integer); cdecl; external RubyDLL;

{ range.c }
function rb_range_new(beg, fin: Tvalue; exclude_end: Integer): Tvalue; cdecl; external RubyDLL;
function rb_range_beg_len(range: Tvalue; begp, lenp: Pointer; len, err: Integer): Tvalue; cdecl; external RubyDLL;

{ re.c }
function rb_mbclen2(c: Cardinal; re: Tvalue): Integer; cdecl; external RubyDLL;
function rb_str_cicmp(str1, str2: Tvalue): Integer; cdecl; external RubyDLL;
function rb_reg_search(reg, str: Tvalue; pos, reverse: Integer): Integer; cdecl; external RubyDLL;
function rb_reg_nth_defined(nth: Integer; match: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_nth_match(nth: Integer; match: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_last_match(match: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_match_pre(match: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_match_post(match: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_match_last(match: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_new(const s: PChar; len, options: Integer): Tvalue; cdecl; external RubyDLL;
function rb_reg_regcomp(str : Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_match(re, str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_reg_match2(re: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_kcode: Integer; cdecl; external RubyDLL;
function rb_reg_options(re: Tvalue): Integer; cdecl; external RubyDLL;
function rb_reg_regsub(str, src: Tvalue; regs: PRERegisters): Tvalue; cdecl; external RubyDLL;
function rb_get_kcode: PChar; cdecl; external RubyDLL;
procedure rb_set_kcode(const code: PChar); cdecl; external RubyDLL;
procedure rb_match_busy(match: Tvalue); cdecl; external RubyDLL;

{ ruby.c }
procedure rb_check_type(x: Tvalue; t: Integer); cdecl; external RubyDLL;
procedure rb_check_safe_str(x: Tvalue); cdecl; external RubyDLL;
procedure rb_secure(level: Integer); cdecl; external RubyDLL;
function rb_num2long(val: Tvalue): Integer; cdecl; external RubyDLL;
function rb_num2ulong(val: Tvalue): Cardinal; cdecl; external RubyDLL;
function rb_num2dbl(n: Tvalue): Double; cdecl; external RubyDLL;
function rb_str2cstr(x: Tvalue; var len: Integer): PChar; {$IFDEF RUBY18}deprecated;{$ENDIF} cdecl; external RubyDLL;

function rb_newobj: Tvalue; cdecl; external RubyDLL;

function rb_data_object_alloc(klass: Tvalue; datap, dmark, dfree: Pointer): Tvalue; cdecl; external RubyDLL;

function rb_define_class(const name: PChar; super: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_define_module(const name: PChar): Tvalue; cdecl; external RubyDLL;
function rb_define_class_under(module: Tvalue; const name: PChar; super: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_define_module_under(module: Tvalue; const name: PChar): Tvalue; cdecl; external RubyDLL;

procedure rb_include_module(klass, module: Tvalue); cdecl; external RubyDLL;
procedure rb_extend_object(obj, module: Tvalue); cdecl; external RubyDLL;

procedure rb_define_variable(const name: PChar; v: Pvalue); cdecl; external RubyDLL;
procedure rb_define_virtual_variable(const name: PChar; getter, setter: Pointer); cdecl; external RubyDLL;
procedure rb_define_hooked_variable(const name: PChar; v: Pvalue; getter, setter: Pointer); cdecl; external RubyDLL;
procedure rb_define_readonly_variable(const name: PChar; v: Pvalue); cdecl; external RubyDLL;
procedure rb_define_const(klass: Tvalue; const name: PChar; v: Tvalue); cdecl; external RubyDLL;
procedure rb_define_global_const(const name: PChar; v: Tvalue); cdecl; external RubyDLL;

function rb_define_method(klass: Tvalue; name: PChar; func: Pointer; argc: integer): Tvalue; cdecl; external RubyDLL;
function rb_define_module_function(module: Tvalue; name: PChar; func: Pointer; argc: integer): Tvalue; cdecl; external RubyDLL;
function rb_define_global_function(name: PChar; func: Pointer; argc: integer): Tvalue; cdecl; external RubyDLL;

procedure rb_undef_method(klass: Tvalue; const name: PChar); cdecl; external RubyDLL;
procedure rb_define_alias(klass: Tvalue; const name1, name2: PChar); cdecl; external RubyDLL;
procedure rb_define_attr(klass: Tvalue; const name: PChar; r, w: Integer); cdecl; external RubyDLL;

function rb_intern(name: PChar): Tid; cdecl; external RubyDLL;
function rb_id2name(id: Tid): PChar; cdecl; external RubyDLL;
function rb_to_id(obj: Tvalue): Tid; cdecl; external RubyDLL;

function rb_class2name(klass: Tvalue): PChar; cdecl; external RubyDLL;

procedure rb_p(obj: Tvalue); cdecl; external RubyDLL;

function rb_eval_string(const str: PChar): Tvalue; cdecl; external RubyDLL;
function rb_eval_string_protect(const str: PChar; var state: Integer): Tvalue; cdecl; external RubyDLL;
function rb_eval_string_wrap(const str: PChar; var state: Integer): Tvalue; cdecl; external RubyDLL;
function rb_funcall2(recv: Tvalue; mid: Tid; argc: Integer; argv: Pointer): Tvalue; cdecl; external RubyDLL;
function rb_funcall3(recv: Tvalue; mid: Tid; argc: Integer; argv: Pointer): Tvalue; cdecl; external RubyDLL;
function rb_call_super(argc: Integer; argv: Pointer): Tvalue; cdecl; external RubyDLL;

function rb_gv_set(const name: PChar; val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_gv_get(const name: PChar): Tvalue; cdecl; external RubyDLL;
function rb_iv_get(obj: Tvalue; const name: PChar): Tvalue; cdecl; external RubyDLL;
function rb_iv_set(obj: Tvalue; const name: PChar; val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_cv_get(obj: Tvalue; const name: PChar): Tvalue; cdecl; external RubyDLL;
function rb_cv_set(obj: Tvalue; const name: PChar; val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_const_get(klass: Tvalue; id: Tid): Tvalue; cdecl; external RubyDLL;
function rb_const_get_at(klass: Tvalue; id: Tid): Tvalue; cdecl; external RubyDLL;
procedure rb_const_set(klass: Tvalue; id: Tid; val: Tvalue); cdecl; external RubyDLL;

function rb_equal(x, y: Tvalue): Tvalue; cdecl; external RubyDLL;

function rb_safe_level: Integer; cdecl; external RubyDLL;
procedure rb_set_safe_level(level: Integer); cdecl; external RubyDLL;

procedure rb_sys_fail(const mesg: PChar); cdecl; external RubyDLL;
procedure rb_iter_break; cdecl; external RubyDLL;
procedure rb_exit(status: Integer); cdecl; external RubyDLL;
procedure rb_notimplement; cdecl; external RubyDLL;

function rb_each(obj: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_yield(val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_block_given_p: Integer; cdecl; external RubyDLL;
function rb_iterate(it_proc: Pointer; data1: Tvalue; bl_proc: Pointer; data2: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_rescue(b_proc: Pointer; data1: Tvalue; r_proc: Pointer; data2: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ensure(b_proc: Pointer; data1: Tvalue; e_proc: Pointer; data2: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_catch(const tag: PChar; proc: Pointer; data: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_throw(const tag: PChar; val: Tvalue); cdecl; external RubyDLL;

function rb_require(const fname: PChar): Tvalue; cdecl; external RubyDLL;

procedure ruby_init; cdecl; external RubyDLL;
procedure ruby_options(argc: Integer; argv: Pointer); cdecl; external RubyDLL;
procedure ruby_run; cdecl; external RubyDLL;
procedure ruby_finalize; cdecl; external RubyDLL;
{$IFDEF RUBY18}
function ruby_cleanup(ex: Integer): Integer; cdecl; external RubyDLL;
function ruby_exec: Integer; cdecl; external RubyDLL;
{$ENDIF}
procedure ruby_stop(ex: Integer); cdecl; external RubyDLL;

procedure ruby_incpush(const path: PChar); cdecl; external RubyDLL;
procedure ruby_init_loadpath; cdecl; external RubyDLL;
procedure require_libraries; cdecl; external RubyDLL;

procedure rb_load_file(fname: PChar); cdecl; external RubyDLL;
procedure ruby_script(fname: PChar); cdecl; external RubyDLL;
procedure ruby_prog_init; cdecl; external RubyDLL;
procedure ruby_set_argv(argc: Integer; argv: Pointer); cdecl; external RubyDLL;
procedure ruby_process_options(argc: Integer; argv: Pointer); cdecl; external RubyDLL;
procedure ruby_load_script; cdecl; external RubyDLL;

{ signal.c }
function rb_f_kill(argc: Integer; argv: Pvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_gc_mark_trap_list; cdecl; external RubyDLL;
procedure rb_trap_exit; cdecl; external RubyDLL;
procedure rb_trap_exec; cdecl; external RubyDLL;
procedure rb_trap_restore_mask; cdecl; external RubyDLL;

{ string.c }
function rb_str_new(const ptr: PChar; len: Longint): Tvalue; cdecl; external RubyDLL;
function rb_str_new2(const ptr: PChar): Tvalue; cdecl; external RubyDLL;
function rb_str_new3(str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_new4(orig: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_tainted_str_new(const ptr: PChar; len: Longint): Tvalue; cdecl; external RubyDLL;
function rb_tainted_str_new2(const ptr: PChar): Tvalue; cdecl; external RubyDLL;
function rb_obj_as_string(obj: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_to_str(str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_dup(str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_plus(str1, str2: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_times(str, times: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_substr(str: Tvalue; beg, len: Longint): Tvalue; cdecl; external RubyDLL;
procedure rb_str_modify(str: Tvalue); cdecl; external RubyDLL;
function rb_str_freeze(str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_resize(str: Tvalue; len: Longint): Tvalue; cdecl; external RubyDLL;
function rb_str_cat(str: Tvalue; const ptr: Pchar; len: Longint): Tvalue; cdecl; external RubyDLL;
function rb_str_concat(str1, str2: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_hash(str: Tvalue): Integer; cdecl; external RubyDLL;
function rb_str_cmp(str1, str2: Tvalue): Integer; cdecl; external RubyDLL;
function rb_str_upto(beg, fin: Tvalue; excl: Integer): Tvalue; cdecl; external RubyDLL;
function rb_str_inspect(str: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_str_split(str: Tvalue; const sep: PChar): Tvalue; cdecl; external RubyDLL;

{ struct.c }
function rb_struct_alloc(klass, values: Tvalue): Tvalue; cdecl; external RubyDLL;

{ util.c }
function rb_test_false_or_nil(v: Tvalue): Integer; cdecl; external RubyDLL;
function ruby_scan_oct(const start: PChar; len: Integer; retlen: Pointer): Integer; cdecl; external RubyDLL;
function ruby_scan_hex(const start: PChar; len: Integer; retlen: Pointer): Integer; cdecl; external RubyDLL;
function ruby_mktemp: PChar; cdecl; external RubyDLL;
procedure ruby_qsort(base: Pointer; nel, size: Integer; cmp: TRetIntFunc); cdecl; external RubyDLL;

{ variable.c }
function rb_mod_name(module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_class_path(klass: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_set_class_path(klass, under: Tvalue; const name: PChar); cdecl; external RubyDLL;
function rb_path2class(const path: PChar): Tvalue; cdecl; external RubyDLL;

procedure rb_name_class(klass: Tvalue; id: Tid); cdecl; external RubyDLL;
procedure rb_autoload(const klass, filename: PChar); cdecl; external RubyDLL;
function rb_f_autoload(obj, klass, f: Tvalue): Tvalue; cdecl; external RubyDLL;
procedure rb_gc_mark_global_tbl; cdecl; external RubyDLL;
function rb_f_trace_var(argc: Integer; argv: Pvalue): Tvalue; cdecl; external RubyDLL;
function rb_f_untrace_var(argc: Integer; argv: Pvalue): Tvalue; cdecl; external RubyDLL;
function rb_f_global_variables: Tvalue; cdecl; external RubyDLL;
procedure rb_alias_variable(name1, name2: Tid); cdecl; external RubyDLL;
function rb_generic_ivar_table(obj: Tvalue): PSTTable; cdecl; external RubyDLL;
procedure rb_clone_generic_ivar(clone, obj: Tvalue); cdecl; external RubyDLL;
procedure rb_mark_generic_ivar(obj: Tvalue); cdecl; external RubyDLL;
procedure rb_mark_generic_ivar_tbl; cdecl; external RubyDLL;
procedure rb_free_generic_ivar(obj: Tvalue); cdecl; external RubyDLL;

function rb_ivar_get(obj: Tvalue; id: Tid): Tvalue; cdecl; external RubyDLL;
function rb_ivar_set(obj: Tvalue; id: Tid; val: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_ivar_defined(obj: Tvalue; id: Tid): Tvalue; cdecl; external RubyDLL;

function rb_obj_instance_variables(obj: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_obj_remove_instance_variable(obj, name: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_mod_const_at(module, ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_mod_constants(module: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_mod_const_of(module, ary: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_mod_remove_const(module, name: Tvalue): Tvalue; cdecl; external RubyDLL;
function rb_const_defined_at(klass: Tvalue; id: Tid): Integer; cdecl; external RubyDLL;
function rb_autoload_defined(id: Tid): Integer; cdecl; external RubyDLL;
function rb_const_defined(klass: Tvalue; id: Tid): Integer; cdecl; external RubyDLL;

{ version.c }
procedure ruby_show_version; cdecl; external RubyDLL;
procedure ruby_show_copyright; cdecl; external RubyDLL;

{ win32.c }
procedure NtInitialize(argcp, argvp: Pointer); cdecl; external RubyDLL;
procedure win32_disable_interrupt; cdecl; external RubyDLL;
procedure win32_enable_interrupt; cdecl; external RubyDLL;

