Compile Dynamic Link Library in UNIX Environment

xiaoxiao2021-03-06  78

# 声 声 动 动 连接 库, assume that the name is libtest.so gcc xc yc zc -fpic -shared -o libtest.so # Connect the main.c and dynamic connection library to generate executable GCC main.c -l. -Ltest -o main # Output LD_Library_Path environment variable, one side dynamic library loader can find required dynamic library export ld_library_path = $ ld_library_path :. # testing is dynamically connected, if libtest.so is listed, then it should be connected to normal LDD main # Don't say it. The purpose of the code segment sharing. -L .: Debt Library to be connected in the current directory ----------------------------------- ---------------------- The above content is from http://www.chinaunix.net/jh/23/373418.html, and made some sort out.

--------------------------------------------------

Generate static link library .a is simpler .cc -c * .cppar -r libdy.a * .o

^ _ ^

转载请注明原文地址:https://www.9cbs.com/read-94225.html

New Post(0)