Building a "Loadable Module"

  • Follow


My application supports loadable modules. I use dlopen to open
mod<name>.so and initialize it using the function mod<name>_init returned
by dlsym. The initializer registers handlers implemented in a variety of
other source files.

My question is, how should this so be built so that everything is exported
properly? I noticed that if I compile like:

   $(CC) -shared $(OBJS) -Wl,-h,modfoo-0.1.0 -o modfoo.so

only modfoo_init is exported. If I build like this:

   $(CC) -shared -Wl,-h,modfoo-0.1.0 -o modfoo.so $(OBJS)

Then all the symbols are exported. Is this the correct method? Does
anyone have any advice regarding loadable modules in general?

Thanks,
Mike
0
Reply Michael 12/11/2004 2:27:16 AM


0 Replies
171 Views

(page loaded in 0.01 seconds)


Reply: