This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F280049: Is sizeof() allowed in linker command file?

Part Number: TMS320F280049

Tool/software: TI C/C++ Compiler

Hi,

I would like to calculate some variable (struct) addresses inside the linker command file.

However, using sizeof() does not seem to be possible and leads to all kinds of errors.

Using fixed constants is okay (no errors), but error prone if the struct size changes.

So should address calculation via sizeof() be possible inside the linker command file?

Regards, Stephan

  • StephanS said:
    So should address calculation via sizeof() be possible inside the linker command file?

    No.  

    I suspect the confusion arises from the fact that C preprocessing statements (#define, #if, #include, etc.) are supported in a linker command file.  You might think that sizeof is yet another preprocessing operator.  But it isn't.  It is not part of the preprocessor language, but the C language.  That being the case, it is not supported by the linker.

    Thanks and regards,

    -George

  • Okay, thanks.