I am porting code from Linux to Solaris(OmniOS v11 r151018), and get link error due to there is no port I/O implementation
This is simplest sample code:
#if defined(__linux__)
#include <sys/io.h>
#elif defined(__sun)
#include <sys/ddi.h>
#include <sys/sunddi.h>
#endif
int main() {
int port = 0;
unsigned char value = 0;
#if defined(__linux__)
outb(value,port);
#elif defined(__sun)
outb(port,value);
#endif
return 0;
}
It will compile success on Linux, but get outb undefined symbol on Solaris:
$ gcc main.c
Undefined first referenced
symbol in file
outb /var/tmp//ccC6aqoL.o
ld: fatal: symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Could someone help me to solve link error? Which library should I link with?