stack size too deep

I try to call a function in an external dynamic library from Ruby, but got stack size too deep error, my ruby code is very simple, so unlikely I have infinite recursive loop in Rudy’s side, I actually created a simple external libsum.dylib just to return the sum of first three parameters and it works well. libsamplesize.dylib works before in older version of RubyOnRails, so I am sure there is no infinite recursive loop inside the library. When I try “compute”, it takes forever to finish, I wonder if stack size needed is over the limit and is there a way to increase it?

Thanks! Liz …

require ‘fiddle/import’

module Libm extend Fiddle::Importer dlload ‘/Library/WebServer/smart/lib/libsamplesize.dylib’ extern ‘long Calculate(long, double, double, char*)’ end

def compute

require ‘fiddle’

require ‘pathname’

if ( session[:sigma_sq] <= 0.0 )

session[:errmsg] = “The value of sigma-squared must be positive.”

session[:n] = -1

elsif ( session[:delta] < 0.0 ) || ( session[:delta] > 1.0 )

if ( session[:delta] < 0.0 ) || ( session[:delta] > 1.0 )
  session[:errmsg] = "The value of delta must be between 0 and 1."
  session[:n] = -1
elsif ( session[:conf] < 0.0 ) || ( session[:conf] > 1.0 )
  session[:errmsg] = "The value of conf must be between 0 and 1."
  session[:n] = -1
elsif ( session[:nmax] < 0.0 )
  session[:errmsg] = "The value of nmax must be positive."
  session[:n] = -1
else

   session[:errmsg] = "                                                                                ";
   session[:n] = Libm.Calculate( session[:nmax], session[:delta],
                      session[:conf], session[:errmsg])
end
redirect_to :action => "results"

end

def results # @sigma_sq = session[:sigma_sq] @delta = session[:delta] @conf = session[:conf] @nmax = session[:nmax] @n = session[:n] @errmsg = session[:errmsg] end …