小编Sat*_*ish的帖子

何时实际使用 dlopen()?dlopen() 是指动态加载吗?

我浏览了下面的链接,通过它我了解了如何创建和使用共享库。 https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html

Step 1: Compiling with Position Independent Code
$ gcc -c -Wall -Werror -fpic foo.c

Step 2: Creating a shared library from an object file
$ gcc -shared -o libfoo.so foo.o

Step 3: Linking with a shared library
$ gcc -L/home/username/foo -Wall -o test main.c -lfoo

Step 4: Making the library available at runtime
$ export LD_LIBRARY_PATH=/home/username/foo:$LD_LIBRARY_PATH
$ ./test
This is a shared library test...
Hello, I am a shared library
Run Code Online (Sandbox Code Playgroud)

但是,我有几个问题:

  1. 在给定的链接中,没有使用打开共享库所需的 dlopen()。这段代码在没有 dlopen() 调用的情况下如何工作?
  2. 何时实际使用 dlopen()?
  3. 我可以在没有 …

linker shared-libraries dynamic-loading dlopen .so

8
推荐指数
1
解决办法
7446
查看次数

标签 统计

.so ×1

dlopen ×1

dynamic-loading ×1

linker ×1

shared-libraries ×1