Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22039

How does gcc `-shared` option affect the output?

$
0
0

Technically, in terms of file content, what is the difference between the output of gcc -fPIC -shared src.c and gcc -fPIC src.c?

Assume that int main(int, char**) is defined in src.c so that both compilations succeed. But executing the a.out generated by gcc -shared src.c, as expected, gave the following error:

-bash: ./a_shared.out: cannot execute binary file

Even if there is a main function it it.

Also, how can I inspect the difference in the output files using tools like otool or objdump?

Thanks a lot.


Viewing all articles
Browse latest Browse all 22039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>