[Hamlib-developer] backend lib loading strategy.
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Frank S. <vk...@ix...> - 2000-09-25 00:33:26
|
Hi, In between the Olympic events I had some thoughts on loading strategies, and share them below. After browsing man page for dl_open etc... :-) Reference Example. <snip> Load the math library, and print the cosine of 2.0: #include <dlfcn.h> int main(int argc, char **argv) { void *handle = dlopen ("/lib/libm.so", RTLD_LAZY); double (*cosine)(double) = dlsym(handle, "cos"); printf ("%f\n", (*cosine)(2.0)); dlclose(handle); } <snip> 1. frontend should load appropriate backend lib at say, rig_init or similar. 2. multiple instances of same RIG type should not cause multiple dl_open requests ?? 3. Must have way of resolving symbol names for dlsym(handle, "symbol_name"); stuff. eg: for things like .. void *handle = dlopen ("libft747.so", RTLD_LAZY); int (*cmd_set_vfo)(vfo_t vfo)= dlsym(handle, "rig_set_vfo"); (*cmd_set_vfo)(RIg_MAIN_VFO) etc.. 4. A whole lot more to come, but you see the idea. 5. GNU libtool ?? 6. Lots of other stuff to follow... /Frank -- Frank Singleton VK3FCS Email: victor kilo three foxtrot charlie sierra at ix dot netcom dot com |