[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Compiling/Executing problems in C
- From: "Kacper Wysocki" <kacperw@...>
- Date: Mon, 9 Jul 2007 22:34:12 +0200
On 7/9/07, Patrick Donnelly <firstname.lastname@example.org> wrote:
> On 7/9/07, Patrick Donnelly <email@example.com> wrote:
Why does `gcc mytest.c -shared` work? I get segmentation faults when I run
-shared produces a dynamic library which resolves some of its
external, unresolved symbols at load or even run time by looking in
the running code's symbol table. This is great for when a program that
provides symbols can load a library that uses them while avoiding
having to compile those symbols into the library... which has nothing
to do with what you're doing :-P
In your case, since nothing provides those symbols, the runtime
linker gives up and your program dumps core. Sorry if this sounds
harsh, but it's probably better to understand what you're doing rather
than trying options blindly - we call that voodoo.
I'm afraid that the kinds of questions you're asking are best answered
in an operating systems course or book - check out Silberschatz'
http://codex.cs.yale.edu/avi/os-book/os7/ - coupled with the
experience I guess you're building up by programming in C already :-)
I actually had fun ripping through the Silberschatz book myself back
in the day not so long ago.
For a quick overview of the (linux-specific, unix general) runtime,
take a look at:
A little background goes a long way in making man pages useful and C
programming (a little) less frustrating.