gcc的-l和-i详解 GTK+3.0入门

时间:2022-12-23 09:12:47

gcc的-l和-i详解

编译动态链接库.so

gcc -shared -fPIC -o 1.so 1.c
-fPIC 作用于编译阶段,告诉编译器产生与位置无关代码(Position-Independent Code),
则产生的代码中,没有绝对地址,全部使用相对地址,故而代码可以被加载器加载到内存的任意
位置,都可以正确的执行。这正是共享库所要求的,共享库被加载时,在内存的位置不是固定的。
从GCC来看,shared应该是包含fPIC选项的,但似 乎不是所以系统都支持,所以最好显式加上fPIC选项。

GTK+3.0入门

https://developer.gnome.org/gtk3/stable/gtk-getting-started.html#id-1.2.3.3
https://developer.gnome.org/gtk3/stable/ch01s05.html
https://developer.gnome.org/gtk3/stable/GtkImage.html
https://developer.gnome.org/gdk-pixbuf/unstable//gdk-pixbuf-The-GdkPixbuf-Structure.html
https://developer.gnome.org/gdk-pixbuf/unstable//gdk-pixbuf-File-Loading.html
https://developer.gnome.org/gdk3/stable/gdk3-Pixbufs.html
http://m.blog.csdn.net/article/details?id=7611837