Dynamic loading of shared objects using dlopen()

后端 未结 2 1586
Happy的楠姐
Happy的楠姐 2021-01-06 03:22

I\'m working on a plain X11 app.

By default, my app only requires libX11.so and the standard gcc C and math libs. The App can extend features with Xfixes, Xrender an

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-06 03:38

    From what I have learned, you just dlopen() (for example) "libXfixes.so", which is most likely a symlink to the newest file "libXfixes.so.3" anyways, in a similar fashion to this one:

    $ file /usr/lib/libalpm.so
    /usr/lib/libalpm.so: symbolic link to `libalpm.so.4.0.3'
    

    A quick overview of my "/usr/lib/" shows, that almost EVERY library in there is symlinked to it's newest ".X" numbered file, and I'm sure that's how it's done on other distribtuions, too.

    Only if you need a specific version of the library, you explicitly name the version "libXfixes.so.2" for example.

提交回复
热议问题