unix下動態庫編譯

2021-08-29 09:30:40 字數 606 閱讀 4949

1 unixware

sco 編譯器建立 pic 的標誌是-kpic gcc 是 -fpic. 鏈結共享庫時 sco 編譯器用 -g 而 gcc 用-shared.

cc -c foo.c

cc -g -o foo.so foo.o

cc -k pic -g -o testso calllib.c

or gcc -fpic -c foo.c

gcc -shared -o foo.so foo.o

linux 下編譯動態庫

gcc -fpic -c so.c

gcc -shared -o so.so so.o

gcc -o testso -ldl

編譯帶動態庫函式的可執行程式時,如果所需要的動態庫不在系統路徑下,則在鏈結時必須使用絕對路徑

2 informix 編譯成動態庫

2.1 esql -c demo.ec

2.2 cc -k pic -c demo.c -i/usr/informix/incl/esql

2.3 cc -g -o demoso.so demo.o

使用範例:esql -o demotest demotest.c demo.so

windows 下 curl動態庫編譯

2 在curl master同級目錄下新建deps資料夾,3 把openssl的庫檔案放在deps資料夾下 需要支援zlib的把zlib庫也放在deps資料夾下。沒有openssl可以自己用vcpkg編譯一下。4 接下來編譯64位的curl庫 開啟vs的命令列,順序執行以下命令 5 來編譯32位的c...

UNIX 動態庫和靜態庫

動態庫,又叫做共享物件庫,以.so結尾。使用動態庫時,編譯器並不直接在編譯的時候將 嵌入到目標檔案中,而是等到執行時呼叫相應的函式,才載入 靜態庫,又叫做歸檔檔案,以.a結尾。使用靜態庫的時候,編譯器在編譯過程中直接將 嵌入到目標檔案中,所以一旦完成編譯,那麼靜態庫可以不需要了。1 編寫靜態庫以及使...

linux下動態庫的編譯使用

linux下動態庫的編譯 1 實踐 test cl.c 1 include 2 include 3 4 extern int add int a,int b 5 define labeladdr 6 main 7 test so.c 1 int add int a,int b 2 test so1....