:i want to copy the functions from my source file into a new file...and
:convert each function into a new object file by compiling it. now, i
:want to invoke the function using the object file i have created and
:not by invoking the original function(i.e delete the part which has the
:function and then try to invoke the same function by including the
bject file into my source code). Is this possible?
If what you mean is that you want to break your source file into
seperate files, one function per file, and then combine the new set
of files into an executable (rather than having a monolithic
source file), then Yes, you can often do that.
C promises that *some* mechanism will exist for linking
files together. C does not, however, put any constraints
on what the commands (or graphics environment) will look
like for telling the compiler that you want to do this.
If your compiler uses a command line, then often you can
accomplish what you {perhaps} want by listing all of the source
file names instead of just the one file name. For example,
if your command line happens to look like
Compile hello.c Producing hello.exe
then possibly a command line such as one of these would work:
Compile init.c whoami.c printout.c Producing hello.exe
or
Compile init.c And whoami.c And printout.c Producing hello.exe
or
Compile {init.c,whoami.c,printout.c} Producing hello.exe
But on the other hand you might have to use something like
Compile init.c Halfway Producing init.obj
Compile whoami.c Halfway Producing whoami.obj
Compile printout.c Halfway Producing printout.obj
Compile More init.obj Producing hello.exe
Compile More whoami.obj Merging Into hello.exe
Compile More printout.obj Merging Into hello.exe
The precise compile mechanism depends upon your operating system
and the compiler you are using, and you would need to ask in
a newsgroup that deals with that compiler on that operating system.
Or better yet, first read the documentation about your compiler.
And before you try the above: I made the syntax up for this posting.
I'd be -quite- surprised if it happens to match any real system.
So RTFM (Read The Fine Manual.)