Click here to Skip to main content
15,887,421 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Linking libraries - follow-up- gcc++ won't link Pin
Richard MacCutchan28-Jan-20 9:22
mveRichard MacCutchan28-Jan-20 9:22 
AnswerSOLVED (?) Re: Linking libraries - follow-up- gcc++ won't link Pin
Vaclav_29-Jan-20 4:00
Vaclav_29-Jan-20 4:00 
GeneralRe: SOLVED (?) Re: Linking libraries - follow-up- gcc++ won't link Pin
Richard MacCutchan29-Jan-20 4:16
mveRichard MacCutchan29-Jan-20 4:16 
QuestionReverse engineering GCC output - need library file (name) and path. Pin
Vaclav_27-Jan-20 5:34
Vaclav_27-Jan-20 5:34 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
Gerry Schmitz27-Jan-20 5:55
mveGerry Schmitz27-Jan-20 5:55 
GeneralRe: Reverse engineering GCC output - need library file (name) and path. Pin
Vaclav_28-Jan-20 2:44
Vaclav_28-Jan-20 2:44 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
Richard MacCutchan27-Jan-20 6:09
mveRichard MacCutchan27-Jan-20 6:09 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
k505427-Jan-20 6:24
mvek505427-Jan-20 6:24 
try ldd myprog. If the library shows up in the output, then it is dynamically linked, e.g. a .so library. If it doesn't, then its a static library (.a).

Usually the linker (ld, not gcc), will prefer the dynamic library over the static, so the resulting executable will a) use new versions of the library, if it gets updated, and b) (less important these days) have a smaller on-disk footprint. If you are linking to the .so and you want to force the linker to use the static library you can do that with the following options to gcc
-Wl,-Bstatic -lsome_lib -Wl,-Bdynamic
If you don't add the -Wl,-Bdynamic at the end, then libc gets statically linked in, too, which is probably not what you want. Of course you could just pass -static to gcc for the final linking stage, and that will produced a static binary (no shared libs), which should run on most linux boxes of with the same architecture (e.g X86 or ARM). I say most, because if you compiled on say Ubuntu 18.04, and tried to run on something ancient, like maybe RedHat 9 (shrike), you would probably get a execution error.

But it would be helpful to know why you want to know this. Normally, we don't care whether we're linking to a dynamic or static library, just as long as the program works. Your question suggests to me that you're bumping up against an issue and are trying to force the OS into doing what you think it should, rather than working with the OS
GeneralRe: Reverse engineering GCC output - need library file (name) and path. Pin
Vaclav_27-Jan-20 7:00
Vaclav_27-Jan-20 7:00 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
leon de boer27-Jan-20 22:28
leon de boer27-Jan-20 22:28 
GeneralRe: Reverse engineering GCC output - need library file (name) and path. Pin
Vaclav_28-Jan-20 2:45
Vaclav_28-Jan-20 2:45 
QuestionDPI aware, I am confused Pin
Erich Jarz23-Jan-20 7:25
Erich Jarz23-Jan-20 7:25 
AnswerRe: DPI aware, I am confused Pin
Gerry Schmitz23-Jan-20 7:37
mveGerry Schmitz23-Jan-20 7:37 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz23-Jan-20 8:27
Erich Jarz23-Jan-20 8:27 
GeneralRe: DPI aware, I am confused Pin
leon de boer24-Jan-20 7:05
leon de boer24-Jan-20 7:05 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz24-Jan-20 7:42
Erich Jarz24-Jan-20 7:42 
GeneralRe: DPI aware, I am confused Pin
leon de boer24-Jan-20 19:41
leon de boer24-Jan-20 19:41 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz26-Jan-20 20:22
Erich Jarz26-Jan-20 20:22 
GeneralRe: DPI aware, I am confused Pin
Gerry Schmitz24-Jan-20 8:27
mveGerry Schmitz24-Jan-20 8:27 
GeneralRe: DPI aware, I am confused Pin
Richard MacCutchan23-Jan-20 9:59
mveRichard MacCutchan23-Jan-20 9:59 
Questionwin32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 6:53
coco24319-Jan-20 6:53 
AnswerRe: win32 Radio button doesn't show when is checked Pin
Victor Nijegorodov19-Jan-20 7:32
Victor Nijegorodov19-Jan-20 7:32 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 8:48
coco24319-Jan-20 8:48 
GeneralRe: win32 Radio button doesn't show when is checked Pin
Victor Nijegorodov19-Jan-20 9:29
Victor Nijegorodov19-Jan-20 9:29 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 10:05
coco24319-Jan-20 10:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.