Hej!

Leif Asbrink wrote:
> The libraries are now loaded at run time in Linrad.
..
> For example, I load libusb-1.0.so and librtlsdr.so with
> dlopen and then get the functions with dlsym.

When doing this, always dlopen() only the base filename including
the ABI version number, so in this case "libusb-1.0.so.0.1.0" and
"librtlsdr.so.0.0.0", without paths.

If you leave out the ABI version then dlopen() is likely to try to
open a linker script which distributions use to "redirect" the linker.
But they are only intended to be used at build time, not at run time.

Using the full filename including ABI version ensures that dlopen()
gets the correct file, and it is also prudent for your application,
since next year there may be a new version of librtlsdr.so which is
no longer ABI compatible with what you designed for today. If you
specify the filename with ABI version then your program still works,
or fails because the old ABI version is not found. If you specify the
filename without ABI version then best case the symbols you need
simply can't be found by dlsym() once the library has been opened.

One minor detail in your rtl2832.c is that dlsym() returns void *
rather than long int, so I suggest using %p in the format string
and not casting the function parameters.

Other than that, can you show us the contents of your
load_usb1_library() and load_rtlsdr_library() functions?


//Peter

Reply via email to