Upper/lowercase shared lib name problem

Hi all,

I’m venturing out into writing C extensions for the first time and have
hit a problem. I searche the list archives for answers but to no avail.

I have a simple Class called MyLib, which is defined in mylib.c . I use
the following extconf.rb to generate a makefile :

require 'mkmf’
create_makefile(‘mylib’)

This generates a Makefile which works and compiles the lib but when I
try and use it I get the following error.

tester.rb:1:in `require’: (null) - ./mylib.so (LoadError)

However if I change the second line of exconf.rb to read

create_makefile(‘MyLib’)

and modify tester.rb to require ‘MyLib’ instead of ‘mylib’ then
everything works. There are plenty of extensions with lowercase names
(gtk.so etc etc) so I’m sure it can be done, I’m just not sure how.
Anyone know where I’m going wrong?

Thanks in advance,
Farrel

···

DNA Research Group mailto:flifson@cs.uct.ac.za
Dept. of Computer Science http://www.cs.uct.ac.za/~flifson
University of Cape Town +27-21-650-3127

require 'mkmf'
create_makefile('mylib')

When you write this, your init function must have the name

    Init_mylib

create_makefile('MyLib')

it work probably because you have defined

    Init_MyLib

Guy Decoux

Thanks! That was exactly the problem. Silly oversight on my part.

Thanks,
Farrel

···

DNA Research Group mailto:flifson@cs.uct.ac.za
Dept. of Computer Science http://www.cs.uct.ac.za/~flifson
University of Cape Town +27-21-650-3127