Article # 539, added by Geoworks, historical record
| first | previous | index | next | last |

I get a HANDLE_FREE error; seems to be a local variable problem.




If I have the following function definition:

void
MyFunction( TCHAR * ptcData )
{
    TCHAR buffer[12];
    strcpy( buffer, ptcData );
}

and change it to be like so:

@start MyResource, data;
@chunk TCHAR buffer[] = "123456789012";
@end MyResource;

void
MyFunction( TCHAR * ptcData )
{
    TCHAR buffer[12];
    MemLock( OptrToHandle( @buffer ) );
    strcpy( (TCHAR*)LMemDeref( @buffer ), ptcData );
    MemUnlock( OptrToHandle( @buffer ) );
}

I don't get a compiler warning at all, and at run-time I get an
HANDLE_FREE error. I don't believe that the compiler can check for
problems like this (between global/local variables and chunk names)
but it is something to be wary of.