Wrote David Plans Casal <dpc / davidcasal.com>, on Wed, Apr 06, 2005 at 10:39:23PM +0900:
> hello people!
> 
> just trying to use extconf.rb script using mkmf to compile a bundle for 
> osx (some c++ libraries)
> 
> compilation is going ok and linking (even libstdc++) seems ok, but 
> invoking the shared bundle in IRB gives me:
> 
> dyld: ruby Undefined symbols:
> <snip>
> (long list of symbols)

Could you include some of the symbols?

Ruby expects an extension to have known entry points and those points
must be declared extern C, i.e. to have C linkage:

  extern "C" void Init_MyClass(void);

  ...

  void Init_MyClass(void)
  {
    ...
  }

could this be the problem?

Sam

> could someone point at the most common reason this happens?
> 
> sorry for such n00b question, but just can't figure it out, tried 
> several different LDFLAGS options after googling, and currently have 
> the following options set:
> 
> if RUBY_PLATFORM =~ /darwin/
>     $CPPFLAGS += " -DUNIX"
>     $LDFLAGS += " -lstdc++ -L/usr/local/lib"
>     dir_config("fmod","/usr/local/include","/usr/local/lib")
> end
> 
> if have_header("fmod.h")
>     if RUBY_PLATFORM =~ /darwin/
>         CONFIG["CC"] = "c++"
>         CONFIG["LDSHARED"].gsub!("cc","g++") #make sure you're using 
> g++ so it links libstdc++
>         CONFIG['LDSHARED'].gsub!('gcc','g++')
>         $create = true if have_library("fmod")
>     elsif have_library("fmod") #more than likely a linux box
>         CONFIG['LDSHARED'].gsub!('gcc','g++') #make sure c++ gets 
> linked properly
>         $create = true
>     end
> end
> 
> any advice?
> 
> thanks!
> 
> david casal
> 
> 

-- 
Sam Roberts <sroberts / certicom.com>