AW: [uClinux-dev] uClinux and Dynamic Loading on Motorola Dragonball

Matthew Natalier matthewn at snapgear.com
Tue Mar 11 09:13:11 EST 2003


patrick wrote:
> 
> I'm not sure how this would help though.  Here's my problem:
> 
> - I have a server application that uses plug in modules
> - Each module conforms to an API -- there are a certain number of
> functions that it *must* have
Ouch.  Lot's of apps do this, and they are a pain for use in uClinux.
user/iptables does this, but also shows a way of getting around it.

> - On load, I use dlopen with RTLD_NOW
> - I use dlsym() to find all of the functions listed in the API and obtain
> pointers to them
This is not supported in uClinux.  Actually I believe there was some
shared library work which worked towards this, but I haven't seen it
released under the GPL.

> - Each of the function pointers are stored in a struct
> - When the server runs, I simply run the pointer:
> 	(*(struct->fcn_ptr))(arg1, ...)
> 
I think the easiest method for getting something like this to work would
be to have each lib statically link into your app.

Declare the public functions as static.

Add an "init" function to each of your libraries which does nothing besides 
register the api.

Look in user/iptables/extensions/initext.c and iptables generally for
how this might work.  Particularly have a look at the init functions in
user/iptables/extensions.

If you want to be able to determine things dynamically, that gets more
complicated.

Cheers

Matt

> -Patrick
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org

-- 
Matthew Natalier
Systems Programmer
p: +61 7 3435 2805
f: +61 7 3891 3630
matthewn at SnapGear.com
http://www.SnapGear.com/
--
SnapGear
Custom Embedded Solutions
Security Appliances




More information about the uClinux-dev mailing list