LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how can I execute a function which is in a object file throgh libbfd! (https://www.linuxquestions.org/questions/programming-9/how-can-i-execute-a-function-which-is-in-a-object-file-throgh-libbfd-831325/)

pet5800 09-10-2010 02:49 AM

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 !

Sergei Steshenko 09-11-2010 05:25 PM

Quote:

Originally Posted by pet5800 (Post 4093203)
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 ?


All times are GMT -5. The time now is 09:13 PM.