Re: Regarding the ".a" files

Erik de Castro Lopo <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Organization Erik Conspiracy Secret Labs
Message-ID <[email protected]>
bill yan wrote:

> Hi,
> 
> I only see ".a" library files for lablgtk2. Does that mean user only can
> staticly link their programs to those libraries? If like that, when
> lablgtk2 will support dynamically linking? Thanks in advance.

Ocaml does not currently support dynamic linking of Ocaml code
but I understand this is coming in version 3.11.

The ".a" libraries you see for liblgtk2 are the Ocaml parts of
the bindings to libgtk2 etc. The C parts of the underlying libraries
can still be dynamically linked.

For instance, ldd for an application I've written looks like this:

        linux-gate.so.1 =>  (0xb7f58000)
        libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb7bc4000)
        libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb7b40000)
        libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb7b25000)
        libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb7b0d000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7ae8000)
        libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb7adf000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7ab5000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0xb7aa7000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb7a9e000)
        libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb7a9b000)
        libXi.so.6 => /usr/lib/libXi.so.6 (0xb7a93000)
        libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb7a8d000)
        libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb7a84000)
        libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0xb7a81000)
        libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0xb7a7d000)
        libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb7a40000)
        libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb79de000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb78f7000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb78f2000)
        libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb78b6000)
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb78b1000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb78ad000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb77fc000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb76ad000)
        /lib/ld-linux.so.2 (0xb7f59000)
        libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb7686000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7618000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb7603000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb75e2000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb75df000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb75bc000)
        libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0xb7592000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb749f000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7494000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb7492000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb747a000)
        libselinux.so.1 => /lib/libselinux.so.1 (0xb7460000)
        libpcre.so.3 => /usr/lib/libpcre.so.3 (0xb7439000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7421000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb741c000)

As you can see, dynamic linking is being used for the C libraries.

HTH,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"I'm not even an atheist so much as I am an antitheist; I not
only maintain that all religions are versions of the same
untruth, but I hold that the influence of churches, and the
effect of religious belief, is positively harmful."
-- Christopher Hitchens in "Letters to a Young Contrarian" 2001
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.