# Problems embedding ruby in win32

**URL:** <https://rubytalk.org/t/problems-embedding-ruby-in-win32/5622>\
**Category:** ruby-talk\
**Created:** [13 April 2003 14:17 UTC](https://rubytalk.org/t/problems-embedding-ruby-in-win32/5622 "2003-04-13T14:17:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaffer](https://avatars.discourse-cdn.com/v4/letter/g/9dc877/32.png) [@Gaffer](https://rubytalk.org/u/Gaffer)\
**Post date:** [13 April 2003 14:17 UTC](https://rubytalk.org/t/problems-embedding-ruby-in-win32/5622/1 "2003-04-13T14:17:29Z")

</div>

hello there,

i’m attempting to embed ruby into a win32 application i’m developing,  
linking statically to the latest ruby 1.8.0 preview release works fine…

however, when i try to link dynamically, i get this error on the first time  
i call rb\_define\_class:

Embedded: wrong argument type Fixnum (expected Class) (TypeError)  
Embedded: [BUG] Segmentation fault  
ruby 1.8.0 (2003-03-03) [i386-mswin32]

here is the offending line:

```
KeyClass = rb_define_class("Key", rb_cObject);

```

it looks to me like this error indicates my headers are out of date with  
what the DLL is expecting somehow (corrupt rb\_cObject?)…

is there anything i need do, define some symbol or something, to get the  
dynamically linked ruby dll working correctly?

does anybody know what could be causing this error?

cheers all

note: i am using vc++ 7.0, latest ruby 1.8.0 preview 2 release

> **···**
>
> -----Original Message-----  
> From: [ruby-talk-admin@ruby-lang.org](mailto:ruby-talk-admin@ruby-lang.org)  
> [[mailto:ruby-talk-admin@ruby-lang.org](mailto:ruby-talk-admin@ruby-lang.org)]  
> Sent: Sunday, April 13, 2003 11:54 PM  
> To: [gaffer@gaffer.org](mailto:gaffer@gaffer.org)  
> Subject: Welcome to our (ruby-talk ML) You are added automatically
> 
> Caution: If you reply this mail, the recipient is mailing list!  
> post articles [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> commands [ruby-talk-ctl@ruby-lang.org](mailto:ruby-talk-ctl@ruby-lang.org)  
> maintainer [ruby-talk-admin@ruby-lang.org](mailto:ruby-talk-admin@ruby-lang.org)
> 
> Welcome to our mailing list [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org) !
> 
> This mail contains the fundamental usage of the mailing list server.
> 
> 1 How to use this server
> 
> Plaese send commands in the mail body not subject to the address  
> [ruby-talk-ctl@ruby-lang.org](mailto:ruby-talk-ctl@ruby-lang.org).
> 
> The command syntax is as follows:
> 
> ```
> # help
> help
> 
> # help
> 
> ```
> 
> or  
> help
> 
> Please send the “# help” to the address [ruby-talk-ctl@ruby-lang.org](mailto:ruby-talk-ctl@ruby-lang.org) for  
> help and  
> server functions overview
> 
> ```
> # help
> 
> ```
> 
> to get general information on this list
> 
> ```
> # guide
> 
> ```
> 
> If you want to make a contact with the mailing list maintainer, please  
> e-mail to
> 
> ```
> ruby-talk-admin@ruby-lang.org
> 
> ```
> 
> ML server exists to decrease routine works by maintainers. Please try  
> to use server functions as could as possible.
> 
> ```
> ruby-talk@ruby-lang.org Maintainer
> ruby-talk-admin@ruby-lang.org
> 
> ```

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [13 April 2003 14:29 UTC](https://rubytalk.org/t/problems-embedding-ruby-in-win32/5622/2 "2003-04-13T14:29:44Z")

</div>

> Embedded: wrong argument type Fixnum (expected Class) (TypeError)  
> Embedded: [BUG] Segmentation fault  
> ruby 1.8.0 (2003-03-03) [i386-mswin32]

When you compile define "IMPORT" and "NT=1" (something like -DIMPORT and  
-DNT=1)

Guy Decoux

---

<div class="post-metadata">

**Author:** ![Simon\_Strandgaard](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Simon\_Strandgaard](https://rubytalk.org/u/Simon_Strandgaard)\
**Post date:** [13 April 2003 15:14 UTC](https://rubytalk.org/t/problems-embedding-ruby-in-win32/5622/3 "2003-04-13T15:14:31Z")

</div>

Perhaps we should add such compile-issues to

> **[WebMD - Better information. Better health.](https://www.webmd.com/?EmbedRuby)**
>
> The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...

Im not a windows person. I there anyone around who can add it ?

> **···**
>
> On Mon, 14 Apr 2003 00:29:44 +0900, ts wrote:
> 
> > > Embedded: wrong argument type Fixnum (expected Class) (TypeError)  
> > > Embedded: [BUG] Segmentation fault  
> > > ruby 1.8.0 (2003-03-03) [i386-mswin32]
> > 
> > When you compile define “IMPORT” and “NT=1” (something like -DIMPORT and  
> > -DNT=1)
> 
> –  
> Simon Strandgaard

---

<div class="post-metadata">

**Author:** ![Gaffer](https://avatars.discourse-cdn.com/v4/letter/g/9dc877/32.png) [@Gaffer](https://rubytalk.org/u/Gaffer)\
**Post date:** [14 April 2003 00:00 UTC](https://rubytalk.org/t/problems-embedding-ruby-in-win32/5622/4 "2003-04-14T00:00:04Z")

</div>

adding “#define IMPORT” before including ruby fixed it, thankyou

(no need to def NT, its already defined under vc7)

cheers

> **···**
>
> -----Original Message-----  
> From: ts [[mailto:decoux@moulon.inra.fr](mailto:decoux@moulon.inra.fr)]  
> Sent: Monday, April 14, 2003 12:30 AM  
> To: ruby-talk ML  
> Cc: [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Subject: Re: problems embedding ruby in win32
> 
> > Embedded: wrong argument type Fixnum (expected Class) (TypeError)  
> > Embedded: [BUG] Segmentation fault  
> > ruby 1.8.0 (2003-03-03) [i386-mswin32]
> 
> When you compile define “IMPORT” and “NT=1” (something like -DIMPORT and  
> -DNT=1)
> 
> Guy Decoux
