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

libraries and memory models

We have a library called 834keil.lib. This library seems to like being linked under the small memory model. There is an associated header file containing two globals with the data attribute. Removing the data attribute yields an error.

We are compiling under the small memory model now and giving our globals an xdata attribute as a work-around.

Parents
  • I guess the question is- Why do we have to use the small memory model to compile the project when we use this library?

    The first answer I have is...Because the library was generated for the SMALL memory model.

    The second answer I have is...You don't. If you want to use the functions in the library from a LARGE model program, you will need to change the prototypes for the functions in the library. In the .H file for the library, make the following change for all prototypes for functions in the library:

    Change...

    int function (int a, int b, int c);

    To...
    int function (int a, int b, int c) small;

    The small at the end of a function prototype specifies that the function is a small model routine.

    Jon

Reply
  • I guess the question is- Why do we have to use the small memory model to compile the project when we use this library?

    The first answer I have is...Because the library was generated for the SMALL memory model.

    The second answer I have is...You don't. If you want to use the functions in the library from a LARGE model program, you will need to change the prototypes for the functions in the library. In the .H file for the library, make the following change for all prototypes for functions in the library:

    Change...

    int function (int a, int b, int c);

    To...
    int function (int a, int b, int c) small;

    The small at the end of a function prototype specifies that the function is a small model routine.

    Jon

Children
No data