473,608 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i want to convert function to an object file..is it possible?

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
object file into my source code). Is this possible?

Nov 15 '05 #1
4 2044
<ve*******@yaho o.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
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
object file into my source code). Is this possible?


Why are you trying to do this? What are you trying to accomplish? There
may be some other way you haven't thought of. Tell us the problem you
trying to solve, not your weird solution. Or at least try your solution
first and tell us what you expected and what went wrong.

I don't see how you can include and object file in your source code, as
it is probably a binary file. It doesn't make sense. You could possibly
convert the C code to Assembler and put the assembly source within an
ASM {} block or whatever (I forget the exact syntax for embedding
assembler in C).

I think object files may have offsets or stack manipulations that would
be incorrect when you compiled the new source, so even the assembler
code may not work. I may be wrong, as it could be the linker that does
this.

Classification: Bad Idea.

--
Mabden
Nov 15 '05 #2
In article <uH************ *****@newssvr21 .news.prodigy.c om>,
Mabden <mabden@sbc_glo bal.net> wrote:
<ve*******@yah oo.com> wrote in message
news:11******* *************** @g14g2000cwa.go oglegroups.com. ..
i want to copy the functions from my source file into a new file...and
....Classification : Bad Idea.


Classification: Smashing the stack for fun and profit.

HTH.
Nov 15 '05 #3
On Thu, 22 Sep 2005 13:53:30 GMT, "Mabden" <mabden@sbc_glo bal.net>
wrote in comp.lang.c:
<ve*******@yaho o.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
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
object file into my source code). Is this possible?


Why are you trying to do this? What are you trying to accomplish? There
may be some other way you haven't thought of. Tell us the problem you
trying to solve, not your weird solution. Or at least try your solution
first and tell us what you expected and what went wrong.

I don't see how you can include and object file in your source code, as
it is probably a binary file. It doesn't make sense. You could possibly
convert the C code to Assembler and put the assembly source within an
ASM {} block or whatever (I forget the exact syntax for embedding
assembler in C).


You didn't forget, there is no syntax for putting assembly language
source code in a C source file, other than perhaps inside a comment
block.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 15 '05 #4
In article <11************ **********@g14g 2000cwa.googleg roups.com>,
<ve*******@yaho o.com> wrote:
: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
:object 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.)
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
Nov 15 '05 #5

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

Similar topics

2
4963
by: Peter Kwan | last post by:
Hi, I believe I have discovered a bug in Python 2.3. Could anyone suggest a get around? When I tested my existing Python code with the newly released Python 2.3, I get the following warning: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up It is because I used some constants such as 0x80ff3366, so I change it to 0x80ff3366L, hoping to get rid of the warning.
7
20410
by: Matthew Thorley | last post by:
I'm writing a web app whereby a user uploads a tar acrhive which is then opened and processed. My web form reads the file like this: while 1: data = value.file.read(1024 * 8) # Read blocks of 8KB at a time if not data: break which leaves me with data as a string obj. The problem that I have is that the function that processes the archive expects a file object. So far the only solution I have found it to write the file to disk and then
3
2691
by: ET | last post by:
I don't know whats the problem, but after I added functions to first verify, then relink linked tables if not found, now I can't convert that database to MDE format. I can split the database, but can't convert part of the database with forms, reports, queries to MDE format. Can somebody advice on this? References, in the order, from the top:
7
3385
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
3
1632
by: Kishore | last post by:
1) Is there a way to convert a file (MPP format) into an XML document in ASP. Is there any relation with XMLSerializer class with this. Can we use this class to convert a file into an XML Document. The conversion need to be done in coding as a web service using ASP/ASP.Net 2) How to import pulic classes into an ASP file (in java we use, import) Thanks
4
1792
by: Brian Parker | last post by:
Here's a snippet of code I have: ============================================== DataSet ds = new DataSet(); string strXMLFileName = Path.GetTempFileName(); StreamWriter sw = File.AppendText( strXMLFileName ); sw.WriteLine(@"<?xml version='1.0'?>"); sw.WriteLine(@"<Results>");
2
1464
by: Chakravarthy | last post by:
Given an XML stream as below, is there any possibility to convert the same into any treditional class style with . (dots) as seperator of the nodes of the xml file... for instance bank.code.tostring() should reslut me "5070" and bank.description.tostring() should result "ICICI - Bangalore"
0
1769
by: Raymond Chiu | last post by:
Dear all, In my vb.net program, I am using excel object to create excel file and stored in a folder. How can it be converted to be pdf file automatically using dotnet coding or others? Actually I have some ideas but no sure in detail (1) If IIS Server installed pdf printer, then using windows object to print excel file through pdf printer and save as pdf file in a folder. How the code should be? (2) Install the software in IIS which...
5
3350
by: sonu | last post by:
hey good morning ...... how to convert a video file in .flv format in php for linux hosting......is there any package whis provide this facility . Can i use ffmpeg for linux hosting project.......... plz help me.. thanks & regards Prabhat
0
8002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8475
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8148
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6816
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6013
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4024
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1594
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1329
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.