# String#to\_ptr w/ Ruby 1.9's DL library is undefined

**URL:** <https://www.ruby-forum.com/t/string-to-ptr-w-ruby-1-9s-dl-library-is-undefined/191658>\
**Category:** Ruby\
**Created:** [July 15, 2010, 10:22pm UTC](https://www.ruby-forum.com/t/string-to-ptr-w-ruby-1-9s-dl-library-is-undefined/191658 "2010-07-15T22:22:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arjackson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@arjackson](https://www.ruby-forum.com/u/arjackson)\
**Post date:** [July 15, 2010, 10:22pm UTC](https://www.ruby-forum.com/t/string-to-ptr-w-ruby-1-9s-dl-library-is-undefined/191658/1 "2010-07-15T22:22:38Z")

</div>

I’m working on porting up an extension from Ruby 1.8 to Ruby 1.9 and  
there is a method on String that gets added when using the DL library  
named to\_ptr in 1.8.  
In 1.9, because the DL library has changed somewhat, that method is now  
undefined.

So, I was wondering if there is an alternative method or way around this  
that achieves the same result? I’ve printed out all the string methods  
using String#methods but I couldn’t find any name that jumped out at me  
as being a good candidate.

I’m pretty new to writing Ruby extensions, so any advice would be  
greatly appreciated.

---

<div class="post-metadata">

**Author:** ![arjackson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@arjackson](https://www.ruby-forum.com/u/arjackson)\
**Post date:** [July 16, 2010, 4:40pm UTC](https://www.ruby-forum.com/t/string-to-ptr-w-ruby-1-9s-dl-library-is-undefined/191658/2 "2010-07-16T16:40:24Z")

</div>

Andrew Rousset wrote:

> I’m working on porting up an extension from Ruby 1.8 to Ruby 1.9 and  
> there is a method on String that gets added when using the DL library  
> named to\_ptr in 1.8.  
> In 1.9, because the DL library has changed somewhat, that method is now  
> undefined.

FFI has a working to\_ptr

it’s like

FFI::MemoryPointer.from\_string(‘some string’)

DL isn’t as cross VL portable so I’m unsure there.  
-r
