c语言中的远函数指针是什么,它的语法是什么

what is far function pointer in c language and what is syntax of it?

本文关键字:是什么 语法 指针 函数 语言      更新时间:2023-10-16

在下面给出的c语言中,远函数指针的语法是什么,下面语句中"远"的用法是什么?为什么在他的陈述中使用了far?

int (far *directCall_setBank)(void);
int VBE_getModeInfo(short mode) {
    VBE_ModeInfoBlock modeInfo;  //Temporary holding space for returned VBE info
    REGS r;        //Register structures for passing to 'int86x()'
    SREGS s;       //(SREGS includes the segment registers)
    r.x.ax=0x4F01; //AL = 0x01, "get VBE Mode Info"
    r.x.cx=mode;   //CX = mode to get info for
    r.x.di=FP_OFF(&modeInfo);   //address ES:DI to our ModeInfoBlock structure
    s.es=FP_SEG(&modeInfo);     //so that the VBE driver will fill its values
    int86x(0x10,&r,&r,&s); //call interrupt 0x10 (through a C function call)
    screen_width=modeInfo.resX;    //Store the values returned in
    screen_height=modeInfo.resY;   //'modeInfo'
    directCall_setBank=modeInfo.winFuncPtr; //INCLUDING the pointer to our function
    return((int)r.h.ah); //Return the VBE status in AH
}

它在dos时代使用,并且非常特定于机器(内存模型)。为了使C独立于特定的体系结构,C在标准语言中从未接受far关键字,但它可以作为某些编译器的扩展。