thunk01.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 36 行

C
36
字号
// WCCP thunk01.c -ox -d1
// generates:
//
//      call final
//      pop si
//      ret
//
// how about?
//
//      pop si
//      jmp final
//
// (only if thunk and final are the same memory model!)
//
extern char *final( char *this, int a, int b );
char *thunk( char *this, int a, int b )
{
    unsigned *cast;

    cast = (void *)this;
    this -= *cast;
    this += 6;
    return( final( this, a, b ) );
}

char (*a[2])( char *this, int a, int b ) = {
    thunk,
    thunk,
};

void foo( void )
{
    char buff[4];
    a[1]( buff, 1, 2 );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?