c - How do I compile a binary which works with both libcrypto.so.0.9.8 and libcryto.so.1.0.0? -


i have autotools c project.

how compile binary works both libcrypto.so.0.9.8 , libcryto.so.1.0.0? (i.e. ubuntu 9.10 , 12.04)

depending on age of os on build, binary requires 1 version or other.

is there way of making not care, or differences between libcryto versions insurmountable?

in opinion, want use function of libcrypto.so.0.9.8 , libcryto.so.1.0.0. if of functions required 1.0.0 or preferred choice link libcrypto.so.1.0.0.

and may need function libcrypto.so.0.9.8 or may have other reasons use libcrypto.so.0.9.8.

in view, if link both library, linker error (duplicate symbols both of library contains same symbols).

if need use 0.9.8, load dynamically using dlopen , function callback want use dlsym.

this can accomplished follows:

void * handle; /*reqd_callback callback of required function.*/ reqd_callback cb;  handle = dlopen ("libcrypto.so.0.9.8", rtld_lazy); cb     = (reqd_callback)dlsym(handle, "reqd_function"); //call cb cb (parameters);  //close library. dlclose(handle); 

i think may solve purpose. if preference inverse, invert library in linking , in loading through program.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -