Discussion Forum

REMOVING UNUSED CODE SEGMENTS

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Alberto Ramirez
Posted
29-Apr-2002 12:35 GMT
Toolset
C51
New! REMOVING UNUSED CODE SEGMENTS

Hello,

I am using a third part library and from map file I notice that I include some code of unused functions in my applycation.

Do you know how I can remove these functions?
And their associated data?

Thanks in advance
Alberto.

Read-Only
Author
Jon Young
Posted
29-Apr-2002 19:12 GMT
Toolset
C51
New! RE: REMOVING UNUSED CODE SEGMENTS
Though this can be safely done, the compiler does not remove these segments. So it is the responsiblity of the library writer to place one function per file to achieve this goal. If you can not get your library writer to do this, then try the following to minimize data loss.

char unusedFns( void )
{
code char unusedFnsArray[] =
{
unusedFn1,
unusedFn2,
unusedFn3
};

return unusedFnsArray[0];
}

void mainProgram( void )
{
//the code that used to be in main
}

void main() //make no changes to this function
{
unusedFns();
mainProgram();
}

Next Thread | Thread List | Previous Thread Start a Thread | Settings