Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • dl/dl.c

Parent

Methods

String

Public Instance Methods

to_ptr() click to toggle source
 
               VALUE
rb_str_to_ptr(VALUE self)
{
  char *ptr;
  int  len;
  VALUE p;

  len = RSTRING(self)->len;
  ptr = (char*)dlmalloc(len + 1);
  memcpy(ptr, RSTRING(self)->ptr, len);
  ptr[len] = '\0';
  p = rb_dlptr_new((void*)ptr,len,dlfree);
  OBJ_INFECT(p, self);
  return p;
}