[fpc-pascal] Parallel Port Access with Free Pascal - windows

Marc Santhoff M.Santhoff at web.de
Sat Jul 23 05:55:55 CEST 2016

On Fr, 2016-07-22 at 18:20 -0400, James Richters wrote:
> I'm trying to avoid custom hardware if possible.  I have always used
> parallel ports and never had a problem with them until now.   I like the
> idea of a parallel port because they are still built onto motherboards, and
> there are also a TON of USB to parallel port adapters out there.   I'm
> trying to keep this simple.
> I put a repository of my test program here:
> https://github.com/Zaaphod/FPC-Parallel-Port.  Perhaps someone can see what
> I'm doing wrong.    I'm reading 255s no matter what I do.    I included my
> old turbo pascal test program.  I would normally specify the port in hex
> with a $ like this $378.  I could write to the port then read back what I
> just wrote.. which is what I am trying to do now.. I don't have anything
> hooked up to the port yet, I should be able to write to it and read it back.
> I seem to be accessing the DLL correctly, because I tried it on a windows 7
> computer and  IsInpOutDriverOpen was false, because I forgot to install the
> driver, once I installed the driver IsInpOutDriverOpen is now true, so that
> tells me I'm accessing the DLL and the DLL is confirming the driver is open.

>From what I know, although it may be a bit outdated, on windows external
functions have to be declared 'cdecl'. Which isn't so in the library
port to pascal.

One example:

  Function IsInpOutDriverOpen; external 'inpout32.DLL';

would then be:

  Function IsInpOutDriverOpen; cdecl; external 'inpout32.DLL';


More information about the fpc-pascal mailing list