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

Declare a pointer table in HCONST space

Declaring the Pointer Table in CODE Space
Hello,

I would like to declare the following array of functions in HCONST space:

code void (code *ArrayOfFunctions[])(void) =
{
MyFunct_1,
MyFunct_2,
...
};


For the moment, this declaration causes a ?CO? segment in CODE space but i would like to locate this table in HCONST space? How can i do it?

Is the following declaration is correct:
code void (code * const far ArrayOfFunctions[])(void) =
{
MyFunct_1,
MyFunct_2,
...
};

Thank you for your help!

  • Hi Tony,

    I can you help with declaration but it is located in HDATA space.

    void func1 (void);
    void func2 (void);
    void func3 (void);
    
    /* function pointer arry with 3 functions */
    const void (far * pFunctions[3])(void)=
    { func1,func2,func3 };
     ....
    Your code
     ....
    void func1 (void){ /* Here what to do */}
    void func2 (void){ /* Here what to do */}
    void func3 (void){ /* Here what to do */}
    

    Normaly the keyword const is used to tell the compiler there are constants, which
    should be located in a const area, but of its nature in this case located to HDATA area.
    Memory modell I selected was HLARGE.
    May be you can use a separate module and
    and use the #pragma MODEL.

    For the use of a function pointer array the function should be the same type and should have the same return type.
    Here I selected void you have to adapted as you need.

    Stefan