Mail Archives: djgpp/2001/06/25/01:46:47
Newsgroups: | comp.os.msdos.djgpp
|
From: | dshnv AT www DOT com
|
Subject: | export/import functions
|
Lines: | 32
|
Message-ID: | <O0oZ6.6917$yp1.236004@www.newsranger.com>
|
X-Abuse-Info: | When contacting newsranger.com regarding abuse please
|
X-Abuse-Info: | forward the entire news article including headers or
|
X-Abuse-Info: | else we will not be able to process your request
|
X-Complaints-To: | abuse AT newsranger DOT com
|
NNTP-Posting-Date: | Sun, 24 Jun 2001 11:52:14 EDT
|
Organization: | http://www.newsranger.com
|
Date: | Sun, 24 Jun 2001 15:52:14 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi,
I have a question about symbol tables. I want to write a program (say, 'blah.c')
that uses a function from another file (say, 'loadme.c'). Loadme contains the
function test():
int test(int i)
{
}
Now I want to call this function from blah.c. Blah.c will load the test()
function from the loadme file. Now my question, how do I know at what offset
test() is placed in the loadme file. I've read something about a symbol table,
but where is this located in a COFF file (or in a MZ-file) and how can I read
this table (what is the size, etc.). And what if the test() function would look
like this:
int test(int i)
{
printf("i = %d\n", i);
}
then the address of printf should be known by test() in some way. Of course
loadme.c could contain an Init() function that would be started at the load
of loadme.c and then get the address of printf from the blah-file but then I
still have to know how to get the location of printf within the blah.o (or
blah.exe) file. I know there are probably other dynamic loaders out there but I
want to write one myself and I just want to know how this could work.
Can anybody help me with this?
Thanks.
- Raw text -