From: Wim Vander Schelden Date: 2006-12-29T06:14:19+09:00 Subject: Ruby extension issue --------------060104070802090300010404 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I am playing around with building ruby extensions in C but I have a problem. I'm trying to make some bindings to SDL, and everything compiles fine, but when I load the extension in IRB, I get the following: irb(main):001:0> require 'gamer' irb: symbol lookup error: ./gamer.so: undefined symbol: SDL_Init My C code is: #include #include #include static VALUE rb_mGamer; static VALUE rb_cScreen; void Init_gamer() { // Create a Gamer module and a Screen class within it rb_mGamer = rb_define_module("Gamer"); rb_cScreen = rb_define_class_under(rb_mGamer, "Screen", rb_cObject); // Try and initialize SDL Sint32 init_res = SDL_Init(SDL_INIT_EVERYTHING); // If not everything went as planned, log the error if(init_res < 0) { if(rb_respond_to(rb_mGamer, rb_intern("log"))) rb_funcall(rb_mGamer, rb_intern("log"), 1, rb_str_new2(SDL_GetError())); } // See what was initialized and set the appropriate flags to true or false Uint32 winit = SDL_WasInit(SDL_INIT_EVERYTHING); if(winit & SDL_INIT_AUDIO) { rb_define_const(rb_mGamer, "audio", Qfalse); } else { rb_define_const(rb_mGamer, "audio", Qtrue); } } Do I have to tell ruby to load the SDL library as well when loading my extension? Thanks in advance, Wim -- Wim Vander Schelden Bachelor Computer Science, University Ghent http://nanoblog.ath.cx My weblog, powered by Ruby and BSD licensed. --------------060104070802090300010404--