I added asm source to KMDF driver project:
.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
In Driver.c file I can call read_port like this:
extern void read_port(unsigned short port, unsigned char* result);
//...
unsigned char val;
read_port(0, &val);
However I can't call this function like that from additional source file, for example test.cpp. Complier gives me unresolved external.
test.cpp:
extern void read_port(unsigned short port, unsigned char* result);
//...
unsigned char val;
read_port(0, &val); // unresolved external
What is the reason?