From: Joseph McDonald Date: 2001-10-02T03:42:32+09:00 Subject: [ruby-talk:21885] Re: Ruby2Exe I did a quick conversion from perl to ruby: #!/usr/local/bin/ruby infile = ARGV[0] out = File.open("cs.c", "w") out.puts <<"EOF" #include "ruby.h" #include #include char key='\xFE'; EOF out.print 'char unenc[] = { "' File.open(infile).each_byte do |c| out.printf("\\x%x",(c^254)) end out.puts <<"EOF" "}; int main(void) { ruby_init(); ruby_script("crypted"); crypt(unenc); //printf("%s",unenc); rb_eval_string(unenc); return 0; } int crypt(char *u1) { while(*u1) *u1++ ^= key; return 0; } EOF out.close system("gcc -lruby -I/usr/lib/ruby/1.6/i386-linux/ -o cs cs.c"); I haven't tested it except for a diff between the output which showed no difference. -joe Monday, October 01, 2001, 10:29:38 AM, you wrote: GC> Dear All, GC> Yesterday I wrote a simple perl script that converts Ruby programs to C GC> (it's actually, pretty simple. It just does a simple XOR encryption on GC> the script, and uses rb_eval_string to run it) Nonetheless, it still GC> works. GC> http://sung.lostgeeks.net/ruby2exe GC> Signed, GC> Gil -- Best regards, Joseph mailto:joe@vpop.net