473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

LINKER/LOADER DOUBT

Hi all,

I m basically trying to understand the linking/loading process, please
bear with me as i have specified my question in an unclear fashion.

Any document that u think can clarify my doubts will also do, just
specify the link of the doc.

After reading some documents online, i have perceived that the some
information about symbol resolution is built into the executable.
(WHAT EXACTLY IS THIS INFORMATION & HOW IT IS USED DURING THE COMPILE
TIME & RUN TIME?, IF POSSIBLE EXPLAIN WITH SOME EXAMPLE). This
requires giving the soname during the compile time(BUT WHT IS THE
MAJOR NUMBER AND RELEASE VERSION INFO IN THE REAL NAME, WHAT IS ITS
SIGNIFICANCE AND HOW IS IT USED). But during loading the loader call
the runtime linker that actually does the relocation of symbols in the
executables, and once relocated the address is fixed ( FIXED IN
CONTEXT OF THE PROCESS?, HOW DOES THIS HAPPENS ?). The global data
of a shared object is static by default, and it gets copied to the
executable process image, and each process is having a private copy of
it.
That means
/* Library code */
foo.c

int fooVar;

int fooFun(){
return ++fooVar;
}

/* executable code */
x.c
main(int argc, char **argv){
for (i != argc)
fooFun();
}

multiple instances of x.c will have private values of fooVar in their
process image, if i invoke them with multiple cmd line params just to
check.

x.c 1 will have 2
x.c 1 2 3 4 5 6 will have 7 ...

IF THIS IS THE CASE, THEN WHERE DOES fooVar IS STORED IN CALLING EXE.
SO ITS THREAD SAFE.

int fooFun(){
static int fooVar;
return ++fooVar;
}
This will have inconsistent behaviour coz its only one instance is
there in dll, SO WHERE IS THIS HAPPENING AND WHERE IS IT STORED, IS IT
AVAILABLE AS A SYMBOL IN THE SHARED LIBRARY. CAN SOMEONE EXPLAIN ME
THE BEHAVIOUR IN CONTEXT OF ONE PROCESS RUNNING MULTIPLE THREADS AND
MULTIPLE INSTANCE OF THE SAME PROCESS.
but all automatic variables are allocated on to the stack of the
executable stack.

int fooFun(){
int fooVar = 0;
return ++fooVar;
}

will always return 1 and fooVar will be alocated onto the stack of
calling process. IS IT SO?

And for all allocation done and released in a function call from
Shared library will use the calling process Heap.
Nov 14 '05 #1
2 1698
Pradeep <pr*****@mauj.com> wrote:
I m basically trying to understand the linking/loading process, please
bear with me as i have specified my question in an unclear fashion.


And then you are unfortunately wrong here. Linking, loading and
processes are things that are outside the realm of C. Typically,
they are rather system specific (but more or less independent of
the language the progam was written in), so your best bet is to
ask in a group that deals with the details of the system you are
using.
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #2
Je***********@physik.fu-berlin.de wrote in message news:<2q*************@uni-berlin.de>...
Pradeep <pr*****@mauj.com> wrote:
I m basically trying to understand the linking/loading process, please
bear with me as i have specified my question in an unclear fashion.


And then you are unfortunately wrong here. Linking, loading and
processes are things that are outside the realm of C. Typically,
they are rather system specific (but more or less independent of
the language the progam was written in), so your best bet is to
ask in a group that deals with the details of the system you are
using.
Regards, Jens


Pls. refer the book
"embedded systems programming in c & c++"
it has a seperate topic about the "linkers, locaters, loaders"

senapathy
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Naresh Agarwal | last post by:
Hi I've written a Custom class loader, which reads the bytecode from a database and returns the Class object. For example, bytecode of a class "Test" is stored in the database. Through custom...
2
by: Bo Brunsgaard | last post by:
I have a problem trying to run SQL*Loader after migrating to Oracle 9. It used to run with no hicups on Oracle 8i, and I'm at my wits' end. Any help? I'm trying to run SQL*Loader from a command...
9
by: Felix Kater | last post by:
Hi, if I link my code to other o-files: Does the linker include the whole o-file or does it use the needed functions from that only? Felix
3
by: Mayank Kaushik | last post by:
Hi everyone, I am confused about how the linker actually goes about generating a memory image. Right now im studying how ld works, i have to use it with an ARM920T. Suppose i have a program...
4
by: Sunil | last post by:
Hi all, I would like to know what is the difference between asembler , compiler , linker & loader. I am new to programming. Sunil.
6
by: nkrisraj | last post by:
Hi, I defined a simple method, getRecsize() inside one of the classes, Class RateRec as shown below. class RateRec { public: size_t getRecSize(void) const; ......
4
by: DaTurk | last post by:
Hi, I've noticed that when trying to create a managed, auto_gcrooted variable in a antive class, the compiler throws linker exceptions. While searching some forums I found out that this is a...
1
by: annappa | last post by:
hi friends, I have some doubt regarding loader, last stage in compilation is loader. After compilation we agail load the program, then what loader do in...
5
by: vshalpatel | last post by:
Hi I want to use SQL*Loader , an Oracle-supplied utility to load data from a flat file into one database tables. for this I have write the scripts in the SQL*LOADER control file named ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.