Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Wrapping a C Library: Allocation and duplication issues

Reply
Thread Tools

Wrapping a C Library: Allocation and duplication issues

 
 
jbonnar@gmail.com
Guest
Posts: n/a
 
      09-11-2006
I'm writing a wrapper for a C library [1] written in a very object
orientated style. Since C isn't an OO language, it uses conventions
instead. All of the "classes" are created with a librdf_new_classname
method which acts almost the same as Ruby's Class#new.

The problem I'm having is cleanly separating allocation from
initialization. Since most of the class construction functions require
arguments to initialize the object, I can't define separate alloc and
initialize functions.

The only option I see is to use Ruby 1.6 style code and define a
Klass.new method for my classes, but how should Klass#clone and
Klass#dup methods be written that take into account object freezing,
taint, etc?

Thanks,
Justin

[1] http://librdf.org/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An idea for heap allocation at near stack allocation speed Bjarke Hammersholt Roune C++ 14 03-06-2011 08:07 AM
static memory allocation versus dynamic memory allocation Ken C Programming 24 11-30-2006 12:37 AM
Wrapping a C Library: Allocation and duplication issues Justin Bonnar Ruby 7 09-13-2006 05:37 PM
What is the difference between dynamic memory allocation,and stack allocation ? chris C++ 6 10-28-2005 05:27 AM
how to build web application and avoid the same page sections duplication(header..) Grzegorz Stasica Java 2 02-12-2004 10:18 AM



Advertisments