views:

34

answers:

1

When sharing an executable do i really need to worry about libraries used to make that executable? seems like that should be taken into consideration when generating the exe not when you have to run it. Just curious. I am pretty sure I don't have to worry but wanted to ask this question to make sure. better to be safe than sorry.

+3  A: 

This is the difference between static and dynamic linking. With static linking, as you've surmised, the relevant portions of library code are directly included (copied) into your binaries. With dynamic linking, a run-time dependency exists; your binary will use OS-dependent techniques to access code in (OS-dependent) shared libraries, such as DLLs on Win32 or SOs on Linux.

If you're not sure whether your program is being compiled with static or dynamic linking, consult your compiler documentation. Additionally, there are tools which can examine the headers of binaries for "import tables" or equivalent and determine what shared libraries, if any, they depend upon. I use GNU objdump with the -x option for this purpose, under both Linux and Windows.

Derrick Turk
how would i do this on solaris 8? any idea how i can check my bin executable to make sure?
djones2010
i think i am referencing a libcryptopp.a file. that is a static link i think.
djones2010
yes .a are static libs (archives)
Greg Domjan