0
votes

I have a code in which am trying to use outportb(), but while compiling it on MinGw i am getting below error.

C:\Users\A_TOMAR\AppData\Local\Temp\ccYPvctv.o:dsp.c:(.text+0x68): undefined reference to `outportb'
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>

int main(void)
{
  outportb(0x378,0xFF);
  return 0;
} 

I would like to know which header file is having this particular function?

2
outportb is a DOS anachronism - even if you could get this to compile it wouldn't work under anything newer than Windows 98. - Paul R
How do i achieve same functionality as provided by outportb using MinGW .I on windows7!! - Amit Singh Tomar
If you're trying to access the parallel port then you will need to use a more appropriate Windows API. - Paul R
Guys i replace this function with _outp and its working fine!! - Amit Singh Tomar
MSDN says that this function doesn't work on WinXP and later versions. Did you get it working on your PC? - Andrey Atapin

2 Answers

1
votes
  1. Windows doesn't provide access to a hardware. You should use Win32 API calls.
  2. This function is DOS specific and unavailable in Windows

Googling shows that your solution is inpout32.dll (example with weird font color)

1
votes
#include <pc.h>
void outportb(unsigned short _port, unsigned char  _data);