Home > Programming > Ruby Programming
Ruby Plays Well With Others - Part 2
Sort Desciption:17 Ruby C Extensions Copyright © 2007 by Object Computing, Inc. (OCI) . All rights reserved. 33 More Information • READ ME. EX T -in Ruby distribution • Programming Ruby, 2nd Edition ...
Content Inside:1 Copyright © 2007 by Object Computing, Inc. (OCI) . All rights reserved. Ruby Plays Well With Others - Part 2 Ruby C Extensions Mark Volkmann mark@ociweb. com Ruby C Extensions Copyright © 2007 by Object Computing, Inc. (OCI) . All rights reserved. 2 Overview • Reasons to -invoke C from Ruby •use C libraries from Ruby applications •performance -invoke Ruby from C •use Ruby libraries from C applications • Ruby can call C code in these ways -interpreter API •since the Ruby interpreter is implemented in C, its API can be used -dont need a special API added for interacting with C like Javas JNI -Ruby Inline •supports mixing C code into Ruby code -SWIG •generates wrapper code for C functions in many languages including Ruby -well focus on the interpreter API here 2 Ruby C Extensions Copyright © 2007 by Object Computing, Inc. (OCI) . All rights reserved. 3 mkmf (make makefile) Ruby Module • Generates platform-specific Makefiles for compiling C extensions to Ruby • Simple usage -create a file containing the following, named extconf. rb by convention require mkmf extension_name = name dir_con fig (extension_name) create_makefile (extension_name) -use by running ruby extconf. rb make -generates • . so under UNIX/Linux • . so under Windows when building with Cygwin • . bundle under Mac OS X mkmf. rb is in $RUBY_HOME/lib Can add conditional processing using these Ruby functions: • check_sizeof • disable_config • enable_config • find_executable • find_header • find_library • have_func • have_header • have_library • have_macro • have_struct_member • have_type • have_var • pkg_config • with_config specifies nonstandard directories where include files and libraries may be found Ruby C Extensions Copyright © 2007 by Object Computing, Inc. (OCI) . All rights reserved. 4 Ruby Constants and Types in C • Boolea ...
Source: ociweb.com
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Related Files
Ruby Course —animmersive programming course—
Filed under: Programming and Ruby ProgrammingLicence Copyrightc 2004-2006 Brian Schroeder Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1 ...
Programming in Ruby
Filed under: Programming and Ruby ProgrammingProgramming in Ruby Dave Thomas Andy Hun t 1 September 13,2000 1 Dave and Andyare authors of Programming Ruby and The Pragmatic Programmer , both from Addison-Wesley.
A Little Ruby, A Lot of Objects
Filed under: Programming and Ruby Programming... to use Ruby for general-purpose programming - and you should, since its a wonderful rapid- development language for many types of applications - the book to read is Programming Ruby ...
JRuby: Bringing Ruby to the Java Platform
Filed under: Programming and Ruby ProgrammingSun Confidential: Internal Only 2 Agenda - Part One • Who Am I • The Ruby Programming Language • Walkthrough 1: Introduction to Ruby • Why Use Ruby? • JRuby:
Sockets programming in Ruby
Filed under: Programming and Ruby ProgrammingSockets programming in Ruby Explore Rubysfundamental sockets interfaces for networking applications Skill Level: Intermediate M. Tim Jones ( mtj@mtjones.com ) Senior Principal ...
