On 11/01/2008, Edwin Pratomo <[EMAIL PROTECTED]> wrote:

> #include <ruby.h>
>
> hi all,
>
> ini crash di tempat saya, dng gcc bawaaan fc6. apakah setup saya yg ngaco
> atau bug di ruby-1.9.0-0? (bisa tolong nyobain ngompail/run program simple
> berikut?)
>
> int main() {
>     char *silly = "def foo; puts \"in foo()\"; end";
>     int error;
>
>     ruby_init();
>     ruby_init_loadpath();
>
>     /* crashes in ruby-1.9.0-0 */
>     rb_eval_string_protect(silly, &error);
>     printf("error: %d", error);
>
>     ruby_finalize();
>     return 0;
> }
>
> rgds,
> Edwin.

mau ngetes apa sih pak, cara ngetesnya kok gitu? berikut ini cuma copy
paste tapi saya kurang yakin apakah path ke ruby19 saya sudah betul
apa nggak.

m:Desktop arie$ which ruby19
/opt/local/ruby19/bin/ruby19
m:ruby19 arie$ ruby19 -v
ruby 1.9.0 (2008-01-11 revision 0) [i686-darwin9.1.0]
m:ruby19 arie$ svn info
Path: .
URL: http://svn.ruby-lang.org/repos/ruby/trunk
Repository Root: http://svn.ruby-lang.org/repos/ruby
Repository UUID: b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Revision: 14990
Node Kind: directory
Schedule: normal
Last Changed Author: nobu
Last Changed Rev: 14990
Last Changed Date: 2008-01-11 11:35:59 +0800 (Fri, 11 Jan 2008)

m:ruby19 arie$ cd ~/Desktop/
m:Desktop arie$ cat silly.c
int main() {
   char *silly = "def foo; puts \"in foo()\"; end";
   int error;

   ruby_init();
   ruby_init_loadpath();

   /* crashes in ruby-1.9.0-0 */
   rb_eval_string_protect(silly, &error);
   printf("error: %d", error);

   ruby_finalize();
   return 0;
}
m:Desktop arie$ gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

m:Desktop arie$ gcc silly.c
silly.c: In function 'main':
silly.c:10: warning: incompatible implicit declaration of built-in
function 'printf'
Undefined symbols:
  "_ruby_init_loadpath", referenced from:
      _main in cc4euV1T.o
  "_rb_eval_string_protect", referenced from:
      _main in cc4euV1T.o
  "_ruby_init", referenced from:
      _main in cc4euV1T.o
  "_ruby_finalize", referenced from:
      _main in cc4euV1T.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
m:Desktop arie$


-- 
r9 = { name: Rie!, ym: riyari3, skype: rubyninja,
li: http://linkedin.com/in/ariekeren,
fb: http://profile.to/ariekeren,
blog: http://tinyurl.com/2bjgvn }

Kirim email ke