# Convert VALUE to c types in ruby3

**URL:** <https://rubytalk.org/t/convert-value-to-c-types-in-ruby3/75942>\
**Category:** ruby-talk\
**Created:** [2 June 2022 16:16 UTC](https://rubytalk.org/t/convert-value-to-c-types-in-ruby3/75942 "2022-06-02T16:16:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lizhongyou2013](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@lizhongyou2013](https://rubytalk.org/u/lizhongyou2013)\
**Post date:** [2 June 2022 16:16 UTC](https://rubytalk.org/t/convert-value-to-c-types-in-ruby3/75942/1 "2022-06-02T16:16:24Z")

</div>

Tanks for reading.

Dear younger friends, middle-age friends and elder friends,

I am trying to use ruby in c and I've found online that I need to convert type VALUE to c types. The webpage said I need to use something likes FIX2INT in ruby/ruby.h, but I can't find this function (or Macro maybe) in ruby/ruby.h for ruby3.

Where can I get the function? Or maybe I need to use another function for ruby3?

A student name Tsing Hui

---

<div class="post-metadata">

**Author:** ![Frank\_J\_Cameron](https://avatars.discourse-cdn.com/v4/letter/f/dc4da7/32.png) [@Frank\_J\_Cameron](https://rubytalk.org/u/Frank_J_Cameron)\
**Post date:** [2 June 2022 20:49 UTC](https://rubytalk.org/t/convert-value-to-c-types-in-ruby3/75942/2 "2022-06-02T20:49:33Z")

</div>

FIX2INT is defined in: ruby/internal/arithmetic/int.h

#include "ruby/ruby.h"  
&nbsp;&nbsp;#include "ruby/internal/arithmetic.h  
&nbsp;&nbsp;&nbsp;&nbsp;#include "ruby/internal/arithmetic/int.h"

> <https://github.com/ruby/ruby/blob/v3_1_2/doc/extension.rdoc>

> **···**
>
> On 6/2/22, 李钟右 \<lizhongyou2013@126.com\> wrote:
> 
> > I am trying to use ruby in c and I've found online that I need to  
> > convert type VALUE to c types. The webpage said I need to use something  
> > likes FIX2INT in ruby/ruby.h, but I can't find this function (or Macro  
> > maybe) in ruby/ruby.h for ruby3.
> > 
> > Where can I get the function? Or maybe I need to use another function  
> > for ruby3?
