I've written a few Ruby native extensions, the usual deal is to have a "target name", foo
say, then have a file ext/foo/foo.c
which defines Init_foo
. I have a need (see below) to have a different filename, ext/foo/bar.c
say, which defines Init_foo
instead. Is this even possible?
Why on Earth do this
I have an existing Gem called foo
, it wraps an existing C library libfoo
which contains a file foo.c
, both are stable and have users. I don't want users of the gem to have to install libfoo
themselves, instead to have it embedded in the gem itself. This is the "packaged source" strategy as described here. When trying to compile with this strategy I get errors about foo.c
being duplicated (as it is). If I could get the "extension file" renamed as above, that should remove this roadblock.