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.
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.