Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking C and Assembly(NASM) - A problem

Status
Not open for further replies.

ekanth

Programmer
Jul 28, 2001
28
0
0
US
Hai,
I just had a problem with linking C and assembly in Linux. I use NASM, gcc and ld for my job. I have an assembly program which calls the C program with a call to main like
'call _main'
I want the program to start its execution from the assembly code and then switch to C. So I thought of setting the entry point in the assembly file. NASM provides a directive ..start: (a label which can be used to set the default entry point "start" which can be used by linker ld).
But unfortunately I found that this directive can be used only for creating DOS obj files and not for elf object files. Can I do this with NASM or should I have to switch to some other assembler for this purpose.
Help me please.

Ekanth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top