我将asm源添加到KMDF驱动程序项目中:
.CODE
read_port PROC port : WORD, result_ptr : PTR BYTE
mov dx, port
in al, dx ; read port
mov rbx, result_ptr
mov BYTE PTR [rbx], al ; place value at result address
ret
read_port ENDP
END
在Driver.c文件中,我可以像这样调用read_port:
extern void read_port(unsigned short port, unsigned char* result);
//...
unsigned char val;
read_port(0, &val);
但是,我无法从其他源文件中调用此函数,例如test.cpp。 Complier给了我未解决的外部。
TEST.CPP:
extern void read_port(unsigned short port, unsigned char* result);
//...
unsigned char val;
read_port(0, &val); // unresolved external
是什么原因?