# Anything disappearing from Ruby for 2.0?

**URL:** <https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125>\
**Category:** ruby-talk\
**Created:** [30 November 2003 12:37 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125 "2003-11-30T12:37:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gavri\_Savio\_Fernande](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@Gavri\_Savio\_Fernande](https://rubytalk.org/u/Gavri_Savio_Fernande)\
**Post date:** [30 November 2003 12:37 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/1 "2003-11-30T12:37:41Z")

</div>

> From: Chris Uppal [[mailto:chris.uppal@metagnostic.REMOVE-THIS.org](mailto:chris.uppal@metagnostic.REMOVE-THIS.org)]  
> Subject: Re: anything disappearing from Ruby for 2.0?
> 
> Ferenc Engard wrote:
> 
> > > Candidates are:
> > > 
> > > - Perl style variables
> > 
> > If you still intend to use ruby for one-liners, then they  
> > should remain  
> > IMHO. Anyway, they do not harm anybody. I vote to not removing them.
> 
> [I’m an outsider delurking on this newsgroup for the first time]
> 
> I want to add the observation that the Perlisms in Ruby were  
> a major (perhaps  
> _the_ major) factor that put me off the language when I  
> looked at it a year or  
> so ago.

yes, a lot of people say that this is a factor which causes them to avoid ruby and i understand that it could be a turn-off for someone being introduced to the language.  
what i’d like to know chris is if you still feel that those perlisms are a turn-off for you.  
i mean, i can understand that you would have been turned off initially, but do you still feel that they are a problem for you?  
or did u mention that you were initially put off because it indicates that it would be a problem when ruby is advocated as an alternative to other languages.

> ```
> -- chris
> 
> ```

Gavri Savio Fernandez

> **···**
>
> * * *
> 
> What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet. - Woody Allen

---

<div class="post-metadata">

**Author:** ![Chris\_Uppal](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Chris\_Uppal](https://rubytalk.org/u/Chris_Uppal)\
**Post date:** [30 November 2003 16:22 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/2 "2003-11-30T16:22:10Z")

</div>

Gavri Savio Fernandez wrote:

> > I want to add the observation that the Perlisms in Ruby were  
> > a major (perhaps  
> > _the_ major) factor that put me off the language when I  
> > looked at it a year or  
> > so ago.
> 
> i mean, i can understand that you would have been turned off initially,  
> but do you still feel that they are a problem for you?  
> or did u mention that you were initially put off because it indicates  
> that it would be a problem when ruby is advocated as an alternative to  
> other languages.

Well, it’s difficult to tell whether I’d have changed my mind after a while,  
but the Perlisms _did_ put me off Ruby, which is why I never did start to use  
it.

I’m still interested, though, so I lurk here occasionally, and watch  
developments with hope.

```
-- chris

```

---

<div class="post-metadata">

**Author:** ![David\_Garamond2](https://avatars.discourse-cdn.com/v4/letter/d/8dc957/32.png) [@David\_Garamond2](https://rubytalk.org/u/David_Garamond2)\
**Post date:** [1 December 2003 04:19 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/3 "2003-12-01T04:19:15Z")

</div>

Gavri Savio Fernandez wrote:

> yes, a lot of people say that this is a factor which causes them to avoid ruby and i understand that it could be a turn-off for someone being introduced to the language.  
> what i’d like to know chris is if you still feel that those perlisms are a turn-off for you.  
> i mean, i can understand that you would have been turned off initially, but do you still feel that they are a problem for you?  
> or did u mention that you were initially put off because it indicates that it would be a problem when ruby is advocated as an alternative to other languages.

Perhaps we can discuss what exactly are the Perlisms in Ruby that people  
hate or see as a major turnoff.

> **···**
>
> –  
> dave

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [1 December 2003 13:55 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/4 "2003-12-01T13:55:28Z")

</div>

> Gavri Savio Fernandez wrote:

> > > I want to add the observation that the Perlisms in Ruby were  
> > > a major (perhaps  
> > > _the_ major) factor that put me off the language when I  
> > > looked at it a year or  
> > > so ago.
> > 
> > i mean, i can understand that you would have been turned off initially,  
> > but do you still feel that they are a problem for you?  
> > or did u mention that you were initially put off because it indicates  
> > that it would be a problem when ruby is advocated as an alternative to  
> > other languages.

> Well, it’s difficult to tell whether I’d have changed my mind after a while,  
> but the Perlisms _did_ put me off Ruby, which is why I never did start to use  
> it.

It’s a totally alien concept to me that the Perlisms should put  
someone off Ruby. They may be ugly, but if everyone acknowledges  
that, then isn’t that OK? Don’t get me wrong, I’ve seen some nasty  
looking Ruby code in my time, but I’ve barely seen any code that uses  
the Perlisms. They seem to exist in theory only (and in some  
sysadmins’ tool chest, which noone should hold against them).

> I’m still interested, though, so I lurk here occasionally, and watch  
> developments with hope.

> ```
> -- chris
> 
> ```

Gavin

> **···**
>
> On Monday, December 1, 2003, 3:22:10 AM, Chris wrote:

---

<div class="post-metadata">

**Author:** ![John\_Long2](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@John\_Long2](https://rubytalk.org/u/John_Long2)\
**Post date:** [1 December 2003 22:40 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/5 "2003-12-01T22:40:12Z")

</div>

Chris Uppal wrote:

> Gavri Savio Fernandez wrote:
> 
> > > I want to add the observation that the Perlisms in Ruby were  
> > > a major (perhaps  
> > > _the_ major) factor that put me off the language when I  
> > > looked at it a year or  
> > > so ago.
> > 
> > i mean, i can understand that you would have been turned off initially,  
> > but do you still feel that they are a problem for you?  
> > \<…snip…\>
> 
> Well, it’s difficult to tell whether I’d have changed my mind after a while,  
> but the Perlisms _did_ put me off Ruby, which is why I never did start to use  
> it.
> 
> I’m still interested, though, so I lurk here occasionally, and watch  
> developments with hope.
> 
> – chris

Why have you not looked into perl? Or even ruby for that matter? I admit  
when I first started working with ruby the $1, $2, $3 variables seemed a  
bit strange, but after working with them I can certainly say it is a  
feature that is both useful and understandable. Do you do much with  
regular expressions? This is where the perl variables shine:

phone\_number = “123-456-789”  
if phone\_number =~ /^(\d\d\d)-(\d\d\d)-(\d\d\d\d)$/  
phone\_number = “(” + $1 + “)” + " " + $2 + “-” + $3  
end  
puts phone\_number #-\> “(123) 456-7890”

These variables are very nice, however the variables that do tend to  
obfuscate the language are the other $\_, $, $… variables. It seems  
like there should be better ways of finding out this kind of  
information. Like a program object of some kind:

$program.pid #-\> 123  
$program.load\_path #-\> [/usr…]

> **···**
>
> –  
> John Long  
> [http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![T\_Onoma](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@T\_Onoma](https://rubytalk.org/u/T_Onoma)\
**Post date:** [1 December 2003 14:20 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/6 "2003-12-01T14:20:20Z")

</div>

I wonder how hard it would be to make perlisms an addon?

require ‘perlisms’

It seems possible. And with the advent of method wrapping even more easily so.

-t0

---

<div class="post-metadata">

**Author:** ![Zach\_Dennis1](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zach\_Dennis1](https://rubytalk.org/u/Zach_Dennis1)\
**Post date:** [2 December 2003 04:15 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/7 "2003-12-02T04:15:23Z")

</div>

I’m trying a very simple example of embedding Ruby in C and I can’t get it  
to work, nor can i find any documentation on how to get it to work. Here’s  
what I’ve got:

#include \<ruby.h\>

int main(int argc, char \*argv[]) {  
ruby\_init();  
rb\_eval\_string(“puts ‘hello world’”);  
ruby\_finalize();  
return 0;  
}

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,

Zach

---

<div class="post-metadata">

**Author:** ![Chris\_Uppal](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Chris\_Uppal](https://rubytalk.org/u/Chris_Uppal)\
**Post date:** [2 December 2003 12:47 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/8 "2003-12-02T12:47:08Z")

</div>

John W. Long wrote:

> > > > I want to add the observation that the Perlisms in Ruby were  
> > > > a major (perhaps  
> > > > _the_ major) factor that put me off the language when I  
> > > > looked at it a year or  
> > > > so ago.  
> > > > […]  
> > > > Why have you not looked into perl? Or even ruby for that matter?

Um… Am I misunderstanding you ? I _have_ looked at Ruby, I think that there  
is much that is of value there, but there are some aspects I don’t like  
(speaking here, again, as an outsider) and which put me off it.

I have also looked at Perl – about every two years since Perl 2 (or so), and  
recoiled in baffled horror each time.

> I admit  
> when I first started working with ruby the $1, $2, $3 variables seemed a  
> bit strange, but after working with them I can certainly say it is a  
> feature that is both useful and understandable.

I’m a long time UNIX programmer, so the ‘$’ variables, don’t seem specially  
_strange_, I just don’t think they have any place in a language that _I_ want  
to use for _my_ purposes. I’m very familar with shell programming, so I speak  
{k,ba,}sh + awk + happily, and feel no need for a scripting language  
to replace that combo; what I would like to find is a flexible, properly  
dynamic, totally OO, reasonably scaleable, language for use in contexts where  
I’m not being obliged to use C++ or Java, and where I’m not able to use my  
preferred Smalltalk. Ruby _so nearly_ fits the bill – kinda fustrating 😉

> Do you do much with  
> regular expressions? This is where the perl variables shine:

To be honest, I see very little value in regexps as a syntactic language  
feature (as opposed to being in a standard library). I don’t _object_ to it,  
but it doesn’t seem to buy much in return for the extra complexity. (And, too,  
if the regexps are given their own syntax, then there’s a tempation to try to  
make all features of regexps available as syntax, rather than just the subset  
that is easy to read). Of course, that is partly a reflection of my own  
programming (outside a scripting context) where I’ve tended to find that using  
regexps is a short-cut that I eventually regret.

```
-- chris

```

---

<div class="post-metadata">

**Author:** ![Ron\_Coutts](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Ron\_Coutts](https://rubytalk.org/u/Ron_Coutts)\
**Post date:** [2 December 2003 04:23 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/9 "2003-12-02T04:23:16Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Eric\_Sunshine](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Eric\_Sunshine](https://rubytalk.org/u/Eric_Sunshine)\
**Post date:** [2 December 2003 05:10 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/10 "2003-12-02T05:10:10Z")

</div>

Assuming that you are correctly linking against the ruby library, you also  
need to ensure that the RUBY\_EXTERN macro (1.8.x) is defined properly (or the  
EXTERN macro for ruby 1.6.x). Look inside Ruby’s define.h file to see if  
this macro is being defined properly for your situation. If it is not, then  
you may have to ensure manually that it is defined in an appropriate manner.  
For instance, you are using Windows, so:

#define RUBY\_EXTERN extern \_\_declspec(dllimport)  
#include \<ruby.h\>

– ES

> **···**
>
> On Tue, 2 Dec 2003 13:15:23 +0900, Zach Dennis wrote:
> 
> > 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

---

<div class="post-metadata">

**Author:** ![T\_Onoma](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@T\_Onoma](https://rubytalk.org/u/T_Onoma)\
**Post date:** [2 December 2003 13:20 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/11 "2003-12-02T13:20:34Z")

</div>

I really don’t understand this. You won’t use Ruby b/c it has some EXTRA  
Perl-like features? D.N.C. Just don’t use them.

-t0

> **···**
>
> On Tuesday 02 December 2003 01:47 pm, Chris Uppal wrote:
> 
> > John W. Long wrote:
> > 
> > > > > > I want to add the observation that the Perlisms in Ruby were  
> > > > > > a major (perhaps  
> > > > > > _the_ major) factor that put me off the language when I  
> > > > > > looked at it a year or  
> > > > > > so ago.
> > > 
> > > […]  
> > > Why have you not looked into perl? Or even ruby for that matter?
> > 
> > Um… Am I misunderstanding you ? I _have_ looked at Ruby, I think that  
> > there is much that is of value there, but there are some aspects I don’t  
> > like (speaking here, again, as an outsider) and which put me off it.
> > 
> > I have also looked at Perl – about every two years since Perl 2 (or so),  
> > and recoiled in baffled horror each time.
> > 
> > > I admit  
> > > when I first started working with ruby the $1, $2, $3 variables seemed a  
> > > bit strange, but after working with them I can certainly say it is a  
> > > feature that is both useful and understandable.
> > 
> > I’m a long time UNIX programmer, so the ‘$’ variables, don’t seem specially  
> > _strange_, I just don’t think they have any place in a language that _I_  
> > want to use for _my_ purposes. I’m very familar with shell programming, so  
> > I speak {k,ba,}sh + awk + happily, and feel no need for a  
> > scripting language to replace that combo; what I would like to find is a  
> > flexible, properly dynamic, totally OO, reasonably scaleable, language for  
> > use in contexts where I’m not being obliged to use C++ or Java, and where  
> > I’m not able to use my preferred Smalltalk. Ruby _so nearly_ fits the bill  
> > – kinda fustrating 😉

---

<div class="post-metadata">

**Author:** ![Zach\_Dennis1](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zach\_Dennis1](https://rubytalk.org/u/Zach_Dennis1)\
**Post date:** [2 December 2003 04:26 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/12 "2003-12-02T04:26:28Z")

</div>

Thanks for replying Ron. I have recently made the move from scripting  
languages to real languages and I’m quite new to compiling.

Zach

> **···**
>
> -----Original Message-----  
> From: Ron Coutts [[mailto:rcoutts@envistatech.com](mailto:rcoutts@envistatech.com)]  
> Sent: Monday, December 01, 2003 11:23 PM  
> To: ruby-talk ML  
> Subject: Re: Embedding Ruby in C
> 
> > 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

---

<div class="post-metadata">

**Author:** ![Zach\_Dennis1](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zach\_Dennis1](https://rubytalk.org/u/Zach_Dennis1)\
**Post date:** [2 December 2003 05:42 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/13 "2003-12-02T05:42:26Z")

</div>

Thanks for the reply Eric. I checked the defines.h file and it has the line  
in it that you suggested. I tried to manually add them to my .c file, but  
still no go. Anymore ideas? Here is what I have tried from the command line:

cl out.c  
cl out.c -IC:\source\ruby-1.8.1  
cl out.c -IC:\source\ruby-1.8.1 /link /INCLUDE:C:\ruby\bin  
cl out.c -IC:\source\ruby-1.8.1 /link /INCLUDE:C:\ruby\lib  
cl out.c -IC:\source\ruby-1.8.1 /link /INCLUDE:C:\source\ruby-1.8.1

Each one of the above is giving me the exact same error as before. I’ve  
tried on Windows 2000 and WinXP.

Zach

> **···**
>
> -----Original Message-----  
> From: Eric Sunshine [[mailto:sunshine@sunshineco.com](mailto:sunshine@sunshineco.com)]  
> Sent: Tuesday, December 02, 2003 12:10 AM  
> To: ruby-talk ML  
> Subject: Re: Embedding Ruby in C
> 
> On Tue, 2 Dec 2003 13:15:23 +0900, Zach Dennis wrote:
> 
> > 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
> 
> Assuming that you are correctly linking against the ruby library, you also  
> need to ensure that the RUBY\_EXTERN macro (1.8.x) is defined properly (or  
> the  
> EXTERN macro for ruby 1.6.x). Look inside Ruby’s define.h file to see if  
> this macro is being defined properly for your situation. If it is not, then  
> you may have to ensure manually that it is defined in an appropriate manner.  
> For instance, you are using Windows, so:
> 
> #define RUBY\_EXTERN extern \_\_declspec(dllimport)  
> #include \<ruby.h\>
> 
> – ES

---

<div class="post-metadata">

**Author:** ![Chris\_Uppal](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Chris\_Uppal](https://rubytalk.org/u/Chris_Uppal)\
**Post date:** [2 December 2003 15:42 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/14 "2003-12-02T15:42:10Z")

</div>

T. Onoma wrote:

> > […] Ruby _so nearly_ fits the bill – kinda fustrating 😉
> 
> I really don’t understand this. You won’t use Ruby b/c it has some EXTRA  
> Perl-like features?

Yes, that’s right.

Elegance, simplicity, clarity – the things that (IMO) are necessary for a  
language to have that “effortless” feeling – are dependent (among other  
things) on a reasonably complete absence of clutter and other warts.

For _me_ the stuff starting on p216 of the pickaxe is a long list of warts. (I  
emphasise that I’m not knocking Ruby; it’s just that its current form is  
optimised for use in a certain way – shortish scripts – that I’m not  
interested in, and so those features of the language add clutter without  
providing compensating value.)

> Just don’t use them.

That’s sort of like saying “if you don’t like foul language then don’t swear”  
😉

```
-- chris

```

---

<div class="post-metadata">

**Author:** ![Brad4](https://avatars.discourse-cdn.com/v4/letter/b/b3f665/32.png) [@Brad4](https://rubytalk.org/u/Brad4)\
**Post date:** [3 December 2003 00:07 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/15 "2003-12-03T00:07:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Sunshine](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@Eric\_Sunshine](https://rubytalk.org/u/Eric_Sunshine)\
**Post date:** [2 December 2003 11:42 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/16 "2003-12-02T11:42:30Z")

</div>

It does not appear that you are linking with the Ruby library. You need to  
link against the library in order for those symbols to be resolved. You  
should read the Microsoft documentation to find out how to specify the  
library on the command-line. (Based upon my reading, I got the impression  
that you can simply specify the library at the end of the command-line after  
the other options following /link. You may also need to specify /libpath in  
order to let the linker know where the library is.)

Depending upon which version and which binary distribution of Ruby you are  
using, the library might be named something like mswin32-ruby18.lib. If you  
are using the source code distribution of Ruby then make sure that you have  
actually built the project so that the .lib file exists.

At run-time, you may also need to place the Ruby .dll in the same directory  
as your .exe file, or make sure that your PATH environment variable mentions  
the directory containing the Ruby .dll.

– ES

> **···**
>
> On Tue, 2 Dec 2003 14:42:26 +0900, Zach Dennis wrote:
> 
> > Thanks for the reply Eric. I checked the defines.h file and it has the line  
> > in it that you suggested. I tried to manually add them to my .c file, but  
> > still no go. Here is what I have tried from the command line:  
> > cl out.c  
> > cl out.c -IC:\source\ruby-1.8.1  
> > cl out.c -IC:\source\ruby-1.8.1 /link /INCLUDE:C:\ruby\bin  
> > cl out.c -IC:\source\ruby-1.8.1 /link /INCLUDE:C:\ruby\lib  
> > cl out.c -IC:\source\ruby-1.8.1 /link /INCLUDE:C:\source\ruby-1.8.1  
> > Each one of the above is giving me the exact same error as before. I’ve  
> > tried on Windows 2000 and WinXP.

---

<div class="post-metadata">

**Author:** ![David\_A\_Black3](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David\_A\_Black3](https://rubytalk.org/u/David_A_Black3)\
**Post date:** [2 December 2003 15:52 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/17 "2003-12-02T15:52:17Z")

</div>

Hi –

> T. Onoma wrote:
> 
> > > […] Ruby _so nearly_ fits the bill – kinda fustrating 😉
> > 
> > I really don’t understand this. You won’t use Ruby b/c it has some EXTRA  
> > Perl-like features?
> 
> Yes, that’s right.
> 
> Elegance, simplicity, clarity – the things that (IMO) are necessary for a  
> language to have that “effortless” feeling – are dependent (among other  
> things) on a reasonably complete absence of clutter and other warts.
> 
> For _me_ the stuff starting on p216 of the pickaxe is a long list of warts. (I  
> emphasise that I’m not knocking Ruby; it’s just that its current form is  
> optimised for use in a certain way – shortish scripts – that I’m not  
> interested in, and so those features of the language add clutter without  
> providing compensating value.)

You can write short programs in Ruby, but it’s not optimized one way  
or the other in that regard. Speed can be an issue, but there’s  
nothing whatsoever in Ruby’s syntax or design to stop one from writing  
longer programs. (Rich Kilmer and Dave Thomas among others can bear  
witness to this 🙂 In sum, Ruby is a nice general-purpose programming  
language; it’s not an admin-script niche tool.

David

> **···**
>
> On Wed, 3 Dec 2003, Chris Uppal wrote:
> 
> –  
> David A. Black  
> [dblack@wobblini.net](mailto:dblack@wobblini.net)

---

<div class="post-metadata">

**Author:** ![T\_Onoma](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@T\_Onoma](https://rubytalk.org/u/T_Onoma)\
**Post date:** [2 December 2003 16:05 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/18 "2003-12-02T16:05:50Z")

</div>

Actually that’s exactly right.

You may not like foul language, but there’s little you can do about other  
people’s use of it --short of depriving yourself of the the rest of the  
wonderful world, living in a box and never coming out.

And so it is with Ruby. I can write obfuscated code with or without perlisms,  
and there’s nothing you can do about it. But you deprive yourself from all of  
Ruby’s bebefits, simply because you won’t manage with a few distates.

In other words, I think your hurting no one but yourself.

Sincerely,

T.

> **···**
>
> On Tuesday 02 December 2003 04:42 pm, Chris Uppal wrote:
> 
> > > Just don’t use them.
> > 
> > That’s sort of like saying “if you don’t like foul language then don’t  
> > swear” 😉

---

<div class="post-metadata">

**Author:** ![Zach\_Dennis1](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zach\_Dennis1](https://rubytalk.org/u/Zach_Dennis1)\
**Post date:** [3 December 2003 02:55 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/19 "2003-12-03T02:55:58Z")

</div>

I got it! Brad you are an inspiration!!! Here’s the cl line I got to work:

cl test.c /link /LIBPATH:c:\source\ruby-1.8.1 msvcrt-ruby18.lib

At first I tried giving an absolute path to the file(  
“c:\source\ruby-1.8.1\msvcrt-ruby18.lib” ) but later saw an example on the  
python newsgroup showing the( “c:\source\ruby-1.8.1 msvcrt-ruby18.lib” ).

I first tried to link against the msvcrt-ruby18-static.lib because it is  
almost 3.5mb, but it didn’t work. It gave me a bunch more unresolved  
external symbol errors. The msvcrt-ruby18.lib seemed to do the job and when  
i was done, i ran it. It worked great!! It was just a simple hello world  
app.

Thanks alot to Brad and Ron for posting their responses.

-Zach

For any search engines scanning this page: msvc microsoft visual c++  
embedding ruby into C program

> **···**
>
> -----Original Message-----  
> From: Brad [[mailto:coish@hfx.eastlink.ca](mailto:coish@hfx.eastlink.ca)]  
> Sent: Tuesday, December 02, 2003 7:07 PM  
> To: ruby-talk ML  
> Subject: Re: Embedding Ruby in C
> 
> 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

---

<div class="post-metadata">

**Author:** ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)\
**Post date:** [2 December 2003 22:11 UTC](https://rubytalk.org/t/anything-disappearing-from-ruby-for-2-0/9125/20 "2003-12-02T22:11:23Z")

</div>

David A. Black wrote:

> > > I really don’t understand this. You won’t use Ruby b/c it has some EXTRA  
> > > Perl-like features?
> > 
> > Yes, that’s right.
> > 
> > Elegance, simplicity, clarity – the things that (IMO) are necessary for a  
> > language to have that “effortless” feeling – are dependent (among other  
> > things) on a reasonably complete absence of clutter and other warts.
> > 
> > For _me_ the stuff starting on p216 of the pickaxe is a long list of warts. (I  
> > emphasise that I’m not knocking Ruby; it’s just that its current form is  
> > optimised for use in a certain way – shortish scripts – that I’m not  
> > interested in, and so those features of the language add clutter without  
> > providing compensating value.)
> 
> You can write short programs in Ruby, but it’s not optimized one way  
> or the other in that regard. Speed can be an issue, but there’s  
> nothing whatsoever in Ruby’s syntax or design to stop one from writing  
> longer programs. (Rich Kilmer and Dave Thomas among others can bear  
> witness to this 🙂 In sum, Ruby is a nice general-purpose programming  
> language; it’s not an admin-script niche tool.

My only comment in favor of what the OP says is this.

When I say “Perlisms” I’m chiefly talking about the  
ugly variables such as $/ and $whatever (and the  
special behaviors associated with them).

I don’t like the Perlisms and I don’t use them. (Note  
how rarely they appear in _The Ruby Way_.) So far, so  
good.

But what if I have to read the code of someone else who  
uses them? For me, that’s a negative.

Another more subtle negative is: The presence of the  
support for the Perlisms increases the complexity of  
the interpreter, possibly making it slower or less  
maintainable.

As always, Matz is boss. Whatever he puts in or leaves  
out, I will get used to it and probably even like it.

Hal
