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

using a NUMBER (const) declaring in a asm file in a C file

Hello,

- I am doing some transformation of a ASM project with including some C procedure.

- I have a const declaring in the asm file like this

//declaration.A51

PUBLIC NUMBER (Tempo)

Number Tempo Equ 10

- I use this const in other asm file like this:

//main.a51

EXTRN NUMBER (Tempo)

mov a,#Tempo

- no problem with this code, I want to use this const in a C file joint to my project like this :

extern const tempo;

variable1 = tempo;

I don't have any problem with compilation (no error and no warning) but this is not the good value giving to the variable1.

variable1 is not 10 but 80? why?

Thanks for your help.

Parents
  • I want to use this const in a C file

    No can do. C's idea of a "const" is radically different from what your your asm NUMBER is. C has no way of expressing what you're trying to do there via a linkable object.

    You'll have to use a #define in a header file instead. Ax51 supports C-style preprocessing directives, too, so such a definition can even be shared between your C and asm source files.

Reply
  • I want to use this const in a C file

    No can do. C's idea of a "const" is radically different from what your your asm NUMBER is. C has no way of expressing what you're trying to do there via a linkable object.

    You'll have to use a #define in a header file instead. Ax51 supports C-style preprocessing directives, too, so such a definition can even be shared between your C and asm source files.

Children
No data