# Calling double rb\_genrand\_real(void); failing

**URL:** <https://www.ruby-forum.com/t/calling-double-rb-genrand-real-void-failing/145591>\
**Category:** Ruby\
**Created:** [August 11, 2008, 9:31pm UTC](https://www.ruby-forum.com/t/calling-double-rb-genrand-real-void-failing/145591 "2008-08-11T21:31:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![polypus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b5ac83/32.png) [@polypus](https://www.ruby-forum.com/u/polypus)\
**Post date:** [August 11, 2008, 9:31pm UTC](https://www.ruby-forum.com/t/calling-double-rb-genrand-real-void-failing/145591/1 "2008-08-11T21:31:14Z")

</div>

hi,

there is a function prototype:

double rb\_genrand\_real(void);

in intern.h which is included by ruby.h

i’d like to call this function from C  
directly rather that calling the rand  
method in order avoid unnecessary overhead.  
i’m not really sure why i am getting this  
at run time though:

dyld: lazy symbol binding failed: Symbol not found: \_rb\_genrand\_real  
Referenced from:  
/Library/Ruby/Gems/1.8/gems/drp-0.9.0/lib/drp\_main\_ext.bundle  
Expected in: dynamic lookup

dyld: Symbol not found: \_rb\_genrand\_real  
Referenced from:  
/Library/Ruby/Gems/1.8/gems/drp-0.9.0/lib/drp\_main\_ext.bundle  
Expected in: dynamic lookup

shouldn’t all functions included through  
ruby.h be available?

thanks,  
\_c

---

<div class="post-metadata">

**Author:** ![polypus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b5ac83/32.png) [@polypus](https://www.ruby-forum.com/u/polypus)\
**Post date:** [August 11, 2008, 11:16pm UTC](https://www.ruby-forum.com/t/calling-double-rb-genrand-real-void-failing/145591/2 "2008-08-11T23:16:39Z")

</div>

Christophe M. wrote:

> method in order avoid unnecessary overhead.  
> /Library/Ruby/Gems/1.8/gems/drp-0.9.0/lib/drp\_main\_ext.bundle  
> Expected in: dynamic lookup
> 
> shouldn’t all functions included through  
> ruby.h be available?
> 
> thanks,  
> \_c

You don’t say which version of Ruby you’re using, but in my 1.8.6 patch  
111 source code there is no such function.

---

<div class="post-metadata">

**Author:** ![polypus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b5ac83/32.png) [@polypus](https://www.ruby-forum.com/u/polypus)\
**Post date:** [August 12, 2008, 12:44am UTC](https://www.ruby-forum.com/t/calling-double-rb-genrand-real-void-failing/145591/3 "2008-08-12T00:44:42Z")

</div>

Tim H. wrote:

> You don’t say which version of Ruby you’re using, but in my 1.8.6 patch  
> 111 source code there is no such function.

Ah, I see it defined in 1.9.0. Are you sure you’re linking with the 1.9  
library?

---

<div class="post-metadata">

**Author:** ![polypus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b5ac83/32.png) [@polypus](https://www.ruby-forum.com/u/polypus)\
**Post date:** [August 12, 2008, 1:29am UTC](https://www.ruby-forum.com/t/calling-double-rb-genrand-real-void-failing/145591/4 "2008-08-12T01:29:11Z")

</div>

Tim H. wrote:

> Tim H. wrote:
> 
> > You don’t say which version of Ruby you’re using, but in my 1.8.6 patch  
> > 111 source code there is no such function.
> 
> Ah, I see it defined in 1.9.0. Are you sure you’re linking with the 1.9  
> library?

doh, thanks for that. i was mistakenly browsing 1.8.7 sources,  
which also include the prototype, and linking against 1.8.6

regards,  
\_c
