[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Embedding Ruby in C

Ron Coutts

12/2/2003 4:23:00 AM

> Here is what i get:
>
> Compiling...
> out.c
> Linking...
> out.obj : error LNK2001: unresolved external symbol _ruby_init
> out.obj : error LNK2001: unresolved external symbol _ruby_finalize
> out.obj : error LNK2001: unresolved external symbol _rb_eval_string
> Debug/out.exe : fatal error LNK1120: 3 unresolved externals
> Error executing link.exe.
>
> out.exe - 4 error(s), 0 warning(s)
>
> Any ideas? Thanks,

Isn't this just a C linker error? I've never embedded ruby myself, but
it seems there's a missing lib file containing the object code for
functions ruby_init, ruby_finalize and rb_eval_string.

Ron


1 Answer

Brad

12/3/2003 12:06:00 AM

0

What's the compile command line look like? Seems to me that you're
trying to link without telling the compiler where the implementation of
ruby_init(), etc. are located.

You need to find out what the name of the shared library (or static
library, which ever you prefer) for your operating system (For example,
on a Linux system the library might be ruby.so or ruby.lib, I don't know
what it's actually called :) ) and link that file to your program.

e.g.
Suppose the library is actually ruby.so
Suppose you're using cc for c compiles

cc out.c -lruby.so

Hope this helps! Sorry I couldn't be more accurate.

Regards,
Brad

Ron Coutts wrote:

> > Here is what i get:
> >
> > Compiling...
> > out.c
> > Linking...
> > out.obj : error LNK2001: unresolved external symbol _ruby_init
> > out.obj : error LNK2001: unresolved external symbol _ruby_finalize
> > out.obj : error LNK2001: unresolved external symbol _rb_eval_string
> > Debug/out.exe : fatal error LNK1120: 3 unresolved externals
> > Error executing link.exe.
> >
> > out.exe - 4 error(s), 0 warning(s)
> >
> > Any ideas? Thanks,
>
> Isn't this just a C linker error? I've never embedded ruby myself, but
> it seems there's a missing lib file containing the object code for
> functions ruby_init, ruby_finalize and rb_eval_string.
>
> Ron
>
>