# Hosting Ruby in C#

**URL:** <https://www.ruby-forum.com/t/hosting-ruby-in-c/169739>\
**Category:** Ruby\
**Created:** [June 8, 2009, 6:51am UTC](https://www.ruby-forum.com/t/hosting-ruby-in-c/169739 "2009-06-08T06:51:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Durgaprasad\_Gorti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Durgaprasad\_Gorti](https://www.ruby-forum.com/u/Durgaprasad_Gorti)\
**Post date:** [June 8, 2009, 6:51am UTC](https://www.ruby-forum.com/t/hosting-ruby-in-c/169739/1 "2009-06-08T06:51:49Z")

</div>

Folks,

I am trying to integrate Ruby into a C# app.

For this, I am trying to use the .NET interop.

It looks like the dll I would like use (On windows Platform)  
is the msvcrt-ruby18.dll.

The dll above seems to export routines with \_ prefix  
such as \_rub\_init(). So technically I could do

A [dllimport and use \_ruby\_init] as the function to call.

To verify my theory, I looked at the ruby.h and I was hoping

To find an ifdef that defines ruby\_init (without the underscore) to  
\_ruby\_init (with underscore)  
I can’t find such a thing.

So my question here is if I am trying to load the msvcrt-ruby18.dll and  
call  
functions  
from the dll, should/could I call these functions with leading  
underscores?

Thanks for your help.

Durgaprasad Gorti

> **[Durgaprasad Gorti's WebLog](https://learn.microsoft.com/en-us/archive/blogs/dgorti/)**

---

<div class="post-metadata">

**Author:** ![Durgaprasad\_Gorti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Durgaprasad\_Gorti](https://www.ruby-forum.com/u/Durgaprasad_Gorti)\
**Post date:** [June 10, 2009, 9:45am UTC](https://www.ruby-forum.com/t/hosting-ruby-in-c/169739/2 "2009-06-10T09:45:58Z")

</div>

“Durgaprasad Gorti” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) schrieb im Newsbeitrag  
news:removed\_email\_address@domain.invalid…

> To find an ifdef that defines ruby\_init (without the underscore) to  
> \_ruby\_init (with underscore)  
> I can’t find such a thing.

The “\_” is automatically added when functions are compiled using  
“C”-linkage. This is done by the compiler w/o preprocessor affected.

> So my question here is if I am trying to load the msvcrt-ruby18.dll and  
> call  
> functions  
> from the dll, should/could I call these functions with leading  
> underscores?

IMHO, no.  
Why you did not just try it?

Regards,  
Michael B.

---

<div class="post-metadata">

**Author:** ![Durgaprasad\_Gorti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Durgaprasad\_Gorti](https://www.ruby-forum.com/u/Durgaprasad_Gorti)\
**Post date:** [June 10, 2009, 1:04pm UTC](https://www.ruby-forum.com/t/hosting-ruby-in-c/169739/3 "2009-06-10T13:04:44Z")

</div>

Durgaprasad Gorti wrote:

> Folks,
> 
> I am trying to integrate Ruby into a C# app.

You may want to try our (free) Ruby Connector:

[http://www.sapphiresteel.com/SapphireSteel-Downloads](http://www.sapphiresteel.com/SapphireSteel-Downloads)

best wishes  
Huw

SapphireSteel Software  
[http://www.sapphiresteel.com](http://www.sapphiresteel.com)
