On Sat, 15 Apr 2006, Oliver Endriss wrote:
> Trent Piepho wrote:
> > What about doing things the old fashioned way, with a library? Stick all the
> > nim (WTF is nim?) code into a directory, one nim per c file, and compile them
> > all into a nim.a library. Then each driver can link against nim.a and will
> > get the nim functions it needs, and not the ones it doesn't. The prototypes
> > could be in a single nim.h, or in nim_{foo,bar,baz}.h for each nim.
>> Please correct me if I'm wrong:
> A library does not wourk because all drivers share the same name space.
> If you try to load two drivers which have the same 'NIM' linked-in, you
> will get a 'duplicate symbol' error...
I guess that's a pretty good reason not to use a library, if that's how it
works. The symbols would be internal to the module, not exported or resolved at
link time, so maybe there isn't a problem. I'll admit I don't really know the
details of how modules are linked by the kernel.
I suppose I should just try it and see...
Seems to work fine. I added non-static global functions with the same name to
two modules, and they loaded fine, each calling their own version of the
function. Not exactly the same as pulling the function in when the module
is linked at compile time, but I think that will work too.