unit uExerb;

interface

uses
{$IFDEF LINUX}
  Libc,
{$ENDIF}
{$IFDEF MSWINDOWS}
  Windows,
{$ENDIF}
  SysUtils, st,
  Rubies;

var
  RuntimeRubyDLL: array[0..MAX_PATH] of Char = RubyDLL;

{$IFDEF MSWINDOWS}
{$I ruby\wrapint.pas}
{$I ruby\macroint.pas}
{$ENDIF}

{$IFDEF LINUX}
{$I ruby/wrapint.pas}
{$I ruby/macroint.pas}
{$ENDIF}

procedure Exerbize;

implementation

uses uStrUtils;

{$IFDEF MSWINDOWS}
{$I ruby\wrapimp.pas}
{$I ruby\macroimp.pas}
{$ENDIF}

{$IFDEF LINUX}
{$I ruby/wrapimp.pas}
{$I ruby/macroimp.pas}
{$ENDIF}

procedure Exerbize;
const
  TestCode =
  'begin; Exerb.type == Module && Exerb.runtime?; rescue Exception; false; end';
var
  ret: Tvalue;
begin
  ret := rb_eval_string(TestCode);
  if RTEST(ret) then
    GetModuleFilename(0{HInstance}, RuntimeRubyDLL, SizeOf(RuntimeRubyDLL));
end;

end.
