Click here to Skip to main content
14,454,989 members

C / C++ / MFC

 
GeneralRe: Linking libraries - follow-up- gcc++ won't link Pin
Richard MacCutchan28-Jan-20 10:22
communityengineerRichard MacCutchan28-Jan-20 10:22 
AnswerSOLVED (?) Re: Linking libraries - follow-up- gcc++ won't link Pin
Vaclav_29-Jan-20 5:00
MemberVaclav_29-Jan-20 5:00 
GeneralRe: SOLVED (?) Re: Linking libraries - follow-up- gcc++ won't link Pin
Richard MacCutchan29-Jan-20 5:16
communityengineerRichard MacCutchan29-Jan-20 5:16 
QuestionReverse engineering GCC output - need library file (name) and path. Pin
Vaclav_27-Jan-20 6:34
MemberVaclav_27-Jan-20 6:34 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
Gerry Schmitz27-Jan-20 6:55
mveGerry Schmitz27-Jan-20 6:55 
GeneralRe: Reverse engineering GCC output - need library file (name) and path. Pin
Vaclav_28-Jan-20 3:44
MemberVaclav_28-Jan-20 3:44 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
Richard MacCutchan27-Jan-20 7:09
communityengineerRichard MacCutchan27-Jan-20 7:09 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
k505427-Jan-20 7:24
Memberk505427-Jan-20 7: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 8:00
MemberVaclav_27-Jan-20 8:00 
AnswerRe: Reverse engineering GCC output - need library file (name) and path. Pin
leon de boer27-Jan-20 23:28
Memberleon de boer27-Jan-20 23:28 
GeneralRe: Reverse engineering GCC output - need library file (name) and path. Pin
Vaclav_28-Jan-20 3:45
MemberVaclav_28-Jan-20 3:45 
QuestionDPI aware, I am confused Pin
Erich Jarz23-Jan-20 8:25
MemberErich Jarz23-Jan-20 8:25 
AnswerRe: DPI aware, I am confused Pin
Gerry Schmitz23-Jan-20 8:37
mveGerry Schmitz23-Jan-20 8:37 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz23-Jan-20 9:27
MemberErich Jarz23-Jan-20 9:27 
GeneralRe: DPI aware, I am confused Pin
leon de boer24-Jan-20 8:05
Memberleon de boer24-Jan-20 8:05 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz24-Jan-20 8:42
MemberErich Jarz24-Jan-20 8:42 
GeneralRe: DPI aware, I am confused Pin
leon de boer24-Jan-20 20:41
Memberleon de boer24-Jan-20 20:41 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz26-Jan-20 21:22
MemberErich Jarz26-Jan-20 21:22 
GeneralRe: DPI aware, I am confused Pin
Gerry Schmitz24-Jan-20 9:27
mveGerry Schmitz24-Jan-20 9:27 
GeneralRe: DPI aware, I am confused Pin
Richard MacCutchan23-Jan-20 10:59
communityengineerRichard MacCutchan23-Jan-20 10:59 
Questionwin32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 7:53
Membercoco24319-Jan-20 7:53 
AnswerRe: win32 Radio button doesn't show when is checked Pin
Victor Nijegorodov19-Jan-20 8:32
MemberVictor Nijegorodov19-Jan-20 8:32 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 9:48
Membercoco24319-Jan-20 9:48 
GeneralRe: win32 Radio button doesn't show when is checked Pin
Victor Nijegorodov19-Jan-20 10:29
MemberVictor Nijegorodov19-Jan-20 10:29 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 11:05
Membercoco24319-Jan-20 11: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.