# Embedding 1.9

**URL:** <https://rubytalk.org/t/embedding-1-9/43583>\
**Category:** ruby-talk\
**Created:** [7 January 2008 21:44 UTC](https://rubytalk.org/t/embedding-1-9/43583 "2008-01-07T21:44:08Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [7 January 2008 21:44 UTC](https://rubytalk.org/t/embedding-1-9/43583/1 "2008-01-07T21:44:08Z")

</div>

Folks:

I'm working on the "Extending Ruby" chapter (now an appendix) for the third PickAxe, and I'm finding a whole bunch of conflicting information. Reading the source, it seems like there's no canonical way of embedding Ruby in a C application. I have lots of alternatives that \_seem\_ to work, but I want to be more authoritative than that.

Does anyone have any pointers to stuff that would help?

Thanks

Dave

---

<div class="post-metadata">

**Author:** ![Mark\_Guzman](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Mark\_Guzman](https://rubytalk.org/u/Mark_Guzman)\
**Post date:** [8 January 2008 01:41 UTC](https://rubytalk.org/t/embedding-1-9/43583/2 "2008-01-08T01:41:14Z")

</div>

Have you checked out VIM? It has ruby embedded and provides an interface into vim buffers from ruby. HTH. Good luck.  
&nbsp;&nbsp;--mark

> **···**
>
> --  
> blog: [http://hasno.info](http://hasno.info)
> 
> Dave Thomas wrote:
> 
> > Folks:
> > 
> > I'm working on the "Extending Ruby" chapter (now an appendix) for the third PickAxe, and I'm finding a whole bunch of conflicting information. Reading the source, it seems like there's no canonical way of embedding Ruby in a C application. I have lots of alternatives that \_seem\_ to work, but I want to be more authoritative than that.
> > 
> > Does anyone have any pointers to stuff that would help?
> > 
> > Thanks
> > 
> > Dave

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [8 January 2008 03:36 UTC](https://rubytalk.org/t/embedding-1-9/43583/3 "2008-01-08T03:36:56Z")

</div>

Hi,

> Folks:
> 
> I'm working on the "Extending Ruby" chapter (now an appendix) for the  
> third PickAxe, and I'm finding a whole bunch of conflicting  
> information. Reading the source, it seems like there's no canonical  
> way of embedding Ruby in a C application. I have lots of alternatives  
> that \_seem\_ to work, but I want to be more authoritative than that.
> 
> Does anyone have any pointers to stuff that would help?

Perhaps "authoritative" means "information from the original author"  
but I don't remember I wrote such document (sigh).

Basically, you have to call:

&nbsp;&nbsp;ruby\_sysinit() for command line argument initialization (optional)  
&nbsp;&nbsp;RUBY\_INIT\_STACK() for GC stack initialization  
&nbsp;&nbsp;ruby\_init() for ruby interpreter initialization

and wrap ruby calls with rb\_protect() for initialize exception frame.  
You can load Ruby programs with rb\_load(). You can call ruby programs  
from string via rb\_eval\_string().

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

> **···**
>
> In message "Re: Embedding 1.9" on Tue, 8 Jan 2008 06:44:08 +0900, Dave Thomas \<dave@pragprog.com\> writes:

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [8 January 2008 03:23 UTC](https://rubytalk.org/t/embedding-1-9/43583/4 "2008-01-08T03:23:02Z")

</div>

Mark:

I don;t believe it has Ruby 1.9, though.

Dave

> **···**
>
> On Jan 7, 2008, at 7:41 PM, Mark Guzman wrote:
> 
> > Have you checked out VIM? It has ruby embedded and provides an interface into vim buffers from ruby. HTH. Good luck.

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [8 January 2008 04:22 UTC](https://rubytalk.org/t/embedding-1-9/43583/5 "2008-01-08T04:22:01Z")

</div>

In 1.9, do we also now need to call set\_locale()?

Dave

> **···**
>
> On Jan 7, 2008, at 9:36 PM, Yukihiro Matsumoto wrote:
> 
> > Perhaps "authoritative" means "information from the original author"  
> > but I don't remember I wrote such document (sigh).
> > 
> > Basically, you have to call:
> > 
> > ruby\_sysinit() for command line argument initialization (optional)  
> > RUBY\_INIT\_STACK() for GC stack initialization  
> > ruby\_init() for ruby interpreter initialization
> > 
> > and wrap ruby calls with rb\_protect() for initialize exception frame.  
> > You can load Ruby programs with rb\_load(). You can call ruby programs  
> > from string via rb\_eval\_string().

---

<div class="post-metadata">

**Author:** ![Edwin\_Pratomo1](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@Edwin\_Pratomo1](https://rubytalk.org/u/Edwin_Pratomo1)\
**Post date:** [9 January 2008 09:45 UTC](https://rubytalk.org/t/embedding-1-9/43583/6 "2008-01-09T09:45:44Z")

</div>

good day all,

while it's still hot talking about embedding, let me ask a related question  
here: is there any way to do reflection from ruby C API?

rgds,  
Edwin.

> **···**
>
> On Tuesday 08 January 2008 10:36:56 am Yukihiro Matsumoto wrote:
> 
> > Basically, you have to call:
> > 
> > &nbsp;&nbsp;ruby\_sysinit() for command line argument initialization (optional)  
> > &nbsp;&nbsp;RUBY\_INIT\_STACK() for GC stack initialization  
> > &nbsp;&nbsp;ruby\_init() for ruby interpreter initialization
> > 
> > and wrap ruby calls with rb\_protect() for initialize exception frame.  
> > You can load Ruby programs with rb\_load(). You can call ruby programs  
> > from string via rb\_eval\_string().
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [8 January 2008 04:40 UTC](https://rubytalk.org/t/embedding-1-9/43583/7 "2008-01-08T04:40:01Z")

</div>

Hi,

> **···**
>
> In message "Re: Embedding 1.9" on Tue, 8 Jan 2008 13:22:01 +0900, Dave Thomas \<dave@pragprog.com\> writes:
> 
> > In 1.9, do we also now need to call set\_locale()?
> 
> Do you mean setlocale()? It's optional. If you call it,  
> Encoding.default\_external will be set according to your locale,  
> otherwise it will be ASCII-8BIT.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

---

<div class="post-metadata">

**Author:** ![Mark\_Guzman](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Mark\_Guzman](https://rubytalk.org/u/Mark_Guzman)\
**Post date:** [8 January 2008 06:20 UTC](https://rubytalk.org/t/embedding-1-9/43583/8 "2008-01-08T06:20:31Z")

</div>

Dave Thomas wrote:

> > Have you checked out VIM? It has ruby embedded and provides an interface into vim buffers from ruby. HTH. Good luck.
> 
> Mark:
> 
> I don;t believe it has Ruby 1.9, though.
> 
> Dave

Quite true. My addled eyes missed the blatant 1.9 in the title.

It did get me started on applying a little elbow work to them problem. The vim code ports to 1.9 just fine. Changing a few of those pesky RSTRING(xyz)-\>ptr and len's to their new macros eliminates the majority of the compile errors. The only other item seems to be error info handling, which went from being a static variable to a function rb\_errinfo. I'm sure you've already run into all the nitty gritty. I've attached a patch versus the current  
vim trunk. I haven't tried anything more intensive than loading and executing a simple file as of yet.

--mark

[if\_ruby\_19.patch](https://rubytalk.org/uploads/short-url/3S9kyJcDIsckvDaNMYtnEX2RBAI.patch) (3.26 KB)

> **···**
>
> > On Jan 7, 2008, at 7:41 PM, Mark Guzman wrote:

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [9 January 2008 09:53 UTC](https://rubytalk.org/t/embedding-1-9/43583/9 "2008-01-09T09:53:15Z")

</div>

Hi,

> **···**
>
> In message "Re: Embedding 1.9" on Wed, 9 Jan 2008 18:45:44 +0900, Edwin Pratomo \<edwin@imt.co.id\> writes:
> 
> > while it's still hot talking about embedding, let me ask a related question  
> > here: is there any way to do reflection from ruby C API?
> 
> What kind of reflection? You can define classes, inspect variables,  
> etc. from C.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [8 January 2008 07:08 UTC](https://rubytalk.org/t/embedding-1-9/43583/10 "2008-01-08T07:08:20Z")

</div>

Mark:

Are you manually defining the TAG\_xxx values somewhere? eval\_intern.h isn't installed onto the user side on my box.

Dave

> **···**
>
> On Jan 8, 2008, at 12:20 AM, Mark Guzman wrote:
> 
> > &nbsp;&nbsp;&nbsp;&nbsp;case TAG\_RAISE:  
> > &nbsp;&nbsp;&nbsp;&nbsp;case TAG\_FATAL:

---

<div class="post-metadata">

**Author:** ![Michal\_hramrach\_Such](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Michal\_hramrach\_Such](https://rubytalk.org/u/Michal_hramrach_Such)\
**Post date:** [8 January 2008 07:59 UTC](https://rubytalk.org/t/embedding-1-9/43583/11 "2008-01-08T07:59:20Z")

</div>

However, calling setlocale should not break ruby 1.9 since the  
interpreter does it as well 😉

Thanks

Michal

> **···**
>
> On 08/01/2008, Yukihiro Matsumoto \<matz@ruby-lang.org\> wrote:
> 
> > Hi,
> > 
> > In message "Re: Embedding 1.9" \> on Tue, 8 Jan 2008 13:22:01 +0900, Dave Thomas \<dave@pragprog.com\> writes:
> > 
> > \>In 1.9, do we also now need to call set\_locale()?
> > 
> > Do you mean setlocale()? It's optional. If you call it,  
> > Encoding.default\_external will be set according to your locale,  
> > otherwise it will be ASCII-8BIT.

---

<div class="post-metadata">

**Author:** ![Edwin\_Pratomo](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Edwin\_Pratomo](https://rubytalk.org/u/Edwin_Pratomo)\
**Post date:** [9 January 2008 10:17 UTC](https://rubytalk.org/t/embedding-1-9/43583/12 "2008-01-09T10:17:13Z")

</div>

in particular, what I would like to do is Object.private\_methods, in C way.

rgds,  
Edwin.

> **···**
>
> --- Yukihiro Matsumoto \<matz@ruby-lang.org\> wrote:
> 
> > Hi,
> > 
> > In message "Re: Embedding 1.9" \> on Wed, 9 Jan 2008 18:45:44 +0900, Edwin Pratomo \<edwin@imt.co.id\> \> writes:
> > 
> > \>while it's still hot talking about embedding, let me ask a related question  
> > \>here: is there any way to do reflection from ruby C API?
> > 
> > What kind of reflection? You can define classes, inspect variables,  
> > etc. from C.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Bergabunglah dengan orang-orang yang berwawasan, di di bidang Anda! Kunjungi Yahoo! Answers saat ini juga di [http://id.answers.yahoo.com/](http://id.answers.yahoo.com/)

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [8 January 2008 17:04 UTC](https://rubytalk.org/t/embedding-1-9/43583/13 "2008-01-08T17:04:02Z")

</div>

Right. The interpreter calls a bunch of methods during initialization. I'm trying to determine the minimum subset required for safe 1.9 operation. I \_think\_ I've got it now, and I'll be pushing it as part of the beta in the next few days.

Thanks

Dave

> **···**
>
> On Jan 8, 2008, at 1:59 AM, Michal Suchanek wrote:
> 
> > However, calling setlocale should not break ruby 1.9 since the  
> > interpreter does it as well 😉

---

<div class="post-metadata">

**Author:** ![Mark\_Guzman](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Mark\_Guzman](https://rubytalk.org/u/Mark_Guzman)\
**Post date:** [8 January 2008 17:05 UTC](https://rubytalk.org/t/embedding-1-9/43583/14 "2008-01-08T17:05:19Z")

</div>

\<(08/01/08 16:08) Dave Thomas\>

> Are you manually defining the TAG\_xxx values somewhere? eval\_intern.h isn't  
> installed onto the user side on my box.

Dave,  
Those are defined locally in if\_ruby.c, that seems to be the convention  
as the tcltk extension does the same. I wonder if those should be pushed  
into ruby.h to ease embedding...?  
&nbsp;&nbsp;--mark

> **···**
>
> --  
> Those the gods wish to destroy they call promising.  
> blog: [http://hasno.info](http://hasno.info)

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [9 January 2008 13:54 UTC](https://rubytalk.org/t/embedding-1-9/43583/15 "2008-01-09T13:54:07Z")

</div>

To call a method that's available in RUby, just use rb\_funcall

&nbsp;&nbsp;&nbsp;&nbsp;rb\_funcall(receiver, mid, argc, arg, arg, ...)

The mid parameter is the ID of the method to invoke (nor its name) and the arguments (if any) are VALUEs,

Dave

> **···**
>
> On Jan 9, 2008, at 4:17 AM, Edwin Pratomo wrote:
> 
> > in particular, what I would like to do is Object.private\_methods, in C way.

---

<div class="post-metadata">

**Author:** ![Dave\_Mail\_Archive](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Mail\_Archive](https://rubytalk.org/u/Dave_Mail_Archive)\
**Post date:** [8 January 2008 18:03 UTC](https://rubytalk.org/t/embedding-1-9/43583/16 "2008-01-08T18:03:49Z")

</div>

That'd get my vote. I've copied core on this..

Dave

> **···**
>
> On Jan 8, 2008, at 11:05 AM, Mark Guzman wrote:
> 
> > > Are you manually defining the TAG\_xxx values somewhere? eval\_intern.h isn't  
> > > installed onto the user side on my box.
> > 
> > Dave,  
> > Those are defined locally in if\_ruby.c, that seems to be the convention  
> > as the tcltk extension does the same. I wonder if those should be pushed  
> > into ruby.h to ease embedding...?

---

<div class="post-metadata">

**Author:** ![Edwin\_Pratomo](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Edwin\_Pratomo](https://rubytalk.org/u/Edwin_Pratomo)\
**Post date:** [10 January 2008 01:03 UTC](https://rubytalk.org/t/embedding-1-9/43583/17 "2008-01-10T01:03:10Z")

</div>

thanks dave, for the pointer.

now I got the following code works (but there is some problem):

static VALUE eval\_failed()  
{  
&nbsp;&nbsp;&nbsp;&nbsp;printf("eval failed\n");  
&nbsp;&nbsp;&nbsp;&nbsp;return Qnil;  
}  
&nbsp;&nbsp;&nbsp;&nbsp;  
static VALUE my\_each(VALUE obj)  
{  
&nbsp;&nbsp;&nbsp;&nbsp;return rb\_funcall(obj, rb\_intern("each"), 0);  
}

static VALUE my\_iterator(VALUE obj)  
{  
&nbsp;&nbsp;&nbsp;&nbsp;int error;  
&nbsp;&nbsp;&nbsp;&nbsp;VALUE result;

&nbsp;&nbsp;&nbsp;&nbsp;result = rb\_protect(my\_each, obj, &error);  
&nbsp;&nbsp;&nbsp;&nbsp;return error ? Qnil : result;  
}

static VALUE my\_iterator\_block(VALUE res)  
{  
&nbsp;&nbsp;&nbsp;&nbsp;printf("args: %s\n", STR2CSTR(rb\_inspect(res)));  
&nbsp;&nbsp;&nbsp;&nbsp;return Qnil;  
}

int main(void) {  
&nbsp;&nbsp;&nbsp;&nbsp;char \*silly = "def foo; end";

&nbsp;&nbsp;&nbsp;&nbsp;ruby\_init();  
&nbsp;&nbsp;&nbsp;&nbsp;ruby\_init\_loadpath();

&nbsp;&nbsp;&nbsp;&nbsp;/\* def foo \*/  
&nbsp;&nbsp;&nbsp;&nbsp;rb\_rescue(rb\_eval\_string, (VALUE)silly, eval\_failed, 0);

&nbsp;&nbsp;&nbsp;&nbsp;/\* Object.private\_methods \*/  
&nbsp;&nbsp;&nbsp;&nbsp;{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE obj = rb\_funcall(rb\_cObject, rb\_intern("private\_methods"), 0);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TYPE(obj) == T\_ARRAY) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("Array!\n");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/\* obj.each {|v| pp v } \*/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rb\_iterate(  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my\_iterator,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obj,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my\_iterator\_block,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("Not array! Can't proceed\n");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;ruby\_finalize();  
&nbsp;&nbsp;&nbsp;&nbsp;exit(0);  
}

\_\_END\_\_

but "foo" is not there! why is it different from:

def foo  
end

Object.private\_methods.each do |x|  
&nbsp;&nbsp;puts x  
end

puts "===================="

Object.private\_methods.select {|x| x =~ /foo/ }.each do |x|  
&nbsp;&nbsp;puts x  
end

\_\_END\_\_

rgds,  
Edwin.

> **···**
>
> --- Dave Thomas \<dave@pragprog.com\> wrote:
> 
> > On Jan 9, 2008, at 4:17 AM, Edwin Pratomo wrote:
> > 
> > \> in particular, what I would like to do is Object.private\_methods, in  
> > \> C way.
> > 
> > To call a method that's available in RUby, just use rb\_funcall
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;rb\_funcall(receiver, mid, argc, arg, arg, ...)
> > 
> > The mid parameter is the ID of the method to invoke (nor its name) and  
> > the arguments (if any) are VALUEs,
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Bergabunglah dengan orang-orang yang berwawasan, di di bidang Anda! Kunjungi Yahoo! Answers saat ini juga di [http://id.answers.yahoo.com/](http://id.answers.yahoo.com/)

---

<div class="post-metadata">

**Author:** ![Paul\_Brannan](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@Paul\_Brannan](https://rubytalk.org/u/Paul_Brannan)\
**Post date:** [9 January 2008 15:35 UTC](https://rubytalk.org/t/embedding-1-9/43583/18 "2008-01-09T15:35:59Z")

</div>

I submitted a bug for this a while ago:

[http://rubyforge.org/tracker/?func=detail&atid=1698&aid=13838&group\_id=426](http://rubyforge.org/tracker/?func=detail&atid=1698&aid=13838&group_id=426)

I see no reason for this to be an opaque value.

Currently I use the #ifndef trick to get the TAG\_ macros.

Paul

> **···**
>
> On Wed, Jan 09, 2008 at 03:03:49AM +0900, Dave Thomas wrote:
> 
> > \> Dave,  
> > \> Those are defined locally in if\_ruby.c, that seems to be the  
> > \> convention as the tcltk extension does the same. I wonder if those  
> > \> should be pushed into ruby.h to ease embedding...?
> > 
> > That'd get my vote. I've copied core on this..
