LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2010, 02:49 AM   #1
pet5800
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Rep: Reputation: 0
Question how can I execute a function which is in a object file throgh libbfd!


Hi guys:
It like this:
I hava a source file add.c

int add(int a,int b){
return a+b;
}

then i compile it, gcc -c add.c
now we get a object file add.o,

I want to execute the function add(int a,int b)(the functinon in the object file add.o)
how can i use libbfd to execute it?

thank you !

Last edited by pet5800; 09-10-2010 at 02:51 AM.
 
Old 09-11-2010, 05:25 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by pet5800 View Post
Hi guys:
It like this:
I hava a source file add.c

int add(int a,int b){
return a+b;
}

then i compile it, gcc -c add.c
now we get a object file add.o,

I want to execute the function add(int a,int b)(the functinon in the object file add.o)
how can i use libbfd to execute it?

thank you !
What does 'libbfd' ( http://en.wikipedia.org/wiki/Binary_...riptor_library ) have to do with your function ? Why do you at all mention it ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ar: .libs/libbfd.a: Error reading archive.o: File truncated grail Programming 4 06-01-2010 06:28 PM
C++ pointer cast from object to function PatrickNew Programming 27 08-25-2008 01:30 PM
How can I get internal function information from a object file SybaseLu Programming 3 08-03-2007 09:20 AM
Manually load object code into RAM and execute it sto237 Linux - Software 3 01-28-2006 09:05 PM
Why don't file and print sharing of Samba pass throgh PPP connection? ritsasa Linux - Networking 1 03-08-2004 07:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration