From: Bill Kelly Date: 2005-09-28T00:33:08+09:00 Subject: dl/import help Hi, (this is a re-post, in its own thread) I'm trying to use dl/import on ruby 1.8.2 (2004-11-06) [i686-linux] to call setrlimit(). However I'm getting this error: (eval):2:in `setrlimit': undefined method `[]' for nil:NilClass (NoMethodError) from rlimit2.rb:16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #!/usr/bin/env ruby require 'dl/import' module LIBC extend DL::Importable dlload "libc.so" RLIMIT_STACK = 3 RLIM_INFINITY = -1 extern "int setrlimit(int, const void *)" end include LIBC rlimit = [RLIM_INFINITY,RLIM_INFINITY].pack('LL').to_ptr result = setrlimit(RLIMIT_STACK, rlimit) # this is line 16 puts result ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I'm using the to_ptr approach to create the structure, described in http://www.jbrowse.com/text/rdl_en.html . Am I doing something wrong? Thanks, Regards, Bill