accessing c macros in asm file

Hello all,
I am trying to use the c macros in asm file. I have 2 different files( sample.c and macro.asm.In sample.c I have defines a macro #define NUM 5 and now I want to use this NUM in asm file.What should I do? Also tell me the way of using the asm file macro in c.
Anand.

Comments

  • : Hello all,
    : I am trying to use the c macros in asm file. I have 2 different files( sample.c and macro.asm.In sample.c I have defines a macro #define NUM 5 and now I want to use this NUM in asm file.What should I do?

    Yes, I have had to crack this nut a couple of times myself. In order to keep the code synchronized, I use a simple text file that contains identifiers and values. Right before I compile, I run that through a little program I wrote that makes a C header file, and an assembly file. My assemblers have a directive that works much like #include does. That way, I can keep both in sync.

    The program doesn't have to be anything difficult, I just use whitespace as a delimiter, and my little tool creates the include guards and capitalizes the macro names for the C header files. For the assembly files, you will need to consult their documentation to learn the proper incantation.

    Anyways, that's just an idea, but I would be interested in hearing how others have tackled this as well.


    HTH,
    Will
    --
    http://www.tuxedo.org/~esr/faqs/smart-questions.html
    http://www.eskimo.com/~scs/C-faq/top.html
    http://www.parashift.com/c++-faq-lite/
    http://www.accu.org/


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion