对于windows:

1,cl primitive.c codec.c application.c /c to generate .obj

2, link primitive.obj /DLL /DEF:primitive.def  This will generate several files. .lib is used to build dlls or exes that refer to primitive.dll.

3, link codec.obj primitive.lib /DLL /DEF:codec.def

4, link application.obj primitive.lib codec.lib

Though codec.dll refer to primitive.dll, there is no order must-bes.

5, dumpbin /exports primitive.lib             you can see that primitive lib export primitive_print function

关于linux

产生so

gcc -g -s -shared -W1,-soname,codec.so -o codec.so codec.o

 gcc -g -s -shared -W1,-soname,prim.so -o prim.so prim.o

使用so

 gcc application.c -o application.exe -L. prim.so codec.so -Wl,-rpath

There is no order must-bes.



评论

该日志第一篇评论

发表评论

评论也有版权!