This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C and Assembly

I want to know how to write assmebly code and c code in same program.... i mean i need to write some function in assembly and some in C code.. i should be able to call both of them from either codes.. how to do this.. help me out..

Parents
  • I think the problem is that the tools (Linker?) somehow recognise a main() written in 'C', and automatically add all the necessary support.
    This doesn't happen when you write an assembler function that just happens to have the name "main".

    as it should be, there is no law forbidding a pure assembler program to have a routine named 'main'. for a pure assembler program you do not want the C initializer to be included.

    Erik

    PS so the smoked sardine will not need to spew his bile "C initializer" refer to startup.a51 and the other code it calls as anybody but him would understand

Reply
  • I think the problem is that the tools (Linker?) somehow recognise a main() written in 'C', and automatically add all the necessary support.
    This doesn't happen when you write an assembler function that just happens to have the name "main".

    as it should be, there is no law forbidding a pure assembler program to have a routine named 'main'. for a pure assembler program you do not want the C initializer to be included.

    Erik

    PS so the smoked sardine will not need to spew his bile "C initializer" refer to startup.a51 and the other code it calls as anybody but him would understand

Children