From: Joel VanderWerf Date: 2004-08-19T07:28:49+09:00 Subject: Re: swig problem with init jim@freeze.org wrote: > I have an innocuous swig/ruby case that is causing me some grief. > The problem is probably obvious, but I'm not seeing the solution > right now. > > I have a .i file that defines a module > > cat itkdb.i > /* itkdb.i */ > %module ITKDb > > %{ > %} > > This generates a wrapper with the following lines of interest: > > #define SWIG_init Init_ITKDb > #define SWIG_name "ITKDb" > > #ifdef __cplusplus > extern "C" > #endif > SWIGEXPORT(void) Init_ITKDb(void) { > int i; > > SWIG_InitRuntime(); > mITKDb = rb_define_module("ITKDb"); > > for (i = 0; swig_types_initial[i]; i++) { > swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); > SWIG_define_class(swig_types[i]); > } > > } > > I compile this against a vendor supplied library and try to load the .so > file and get: > > ruby -r itkdb -e {} > ./itkdb.so: /usr/lib/libruby.so.1.8: undefined symbol: Init_itkdb - > ./itkdb.so (LoadError) > > Can someone tell me what I'm doing wrong here? Ruby's loader looks for init_ in filename.so. So if you mv itkdb.so ITKDb.so it may work.