K8061 with www.freepascal.org FPC

Hi guys! I built the K8061 USB Interface project and it works fine with the included Test Demo program. I also put the included files ‘K8061.dll’ and ‘MPUSBAPI.dll’ over into the ‘Windows/System32’ subdirectory (as recommended).

PRELUDE/BACKGROUND Info (regarding my Question and my Problem):

Now, just so you know, the FPC free pascal (that is available for download at freepascal.org) has an ‘OPTIONS’ tab (in the list with ‘FILE’ ‘EDIT’ ‘COMPILE’ etc.) and, once selected, the dialog box that appears has numerous Compiler Options. One of the options permits you to compile your source code FILE as if it were written in Delphi. I selected the ‘Delphi’ option. For simple ‘Hello World!’ programs, everything works fine when this is done.

Now, included with the K8061 kit is a PDF file called ‘K8061_DLL_manual.pdf’. In this file the documentation gives source code (written in Delphi) for creating a ‘unit’ that accesses the routines held within the ‘K8061.DLL’ dynamic link library. I copied this source code and created a source code FILE with a ‘.PAS’ extension. The FPC free pascal acknowledges and loads this ‘.PAS’ file into its IDE editor without any problem. (NOTE: within the source code, the first line has the command word ‘unit’. The name of the ‘unit’ appears IMMEDIATELY next in the source code. The name that you give TO the source code file ON YOUR DISK MUST BE EXACTLY THE SAME AS the name for the ‘unit’ that appears immediately AFTER the command word ‘unit’ in the source code. Before these items were Matched Up, I would get a compiler error. Now they are matched up and I do not get the associated error).

So far, so good.

MY PROBLEM:

When I go to ‘COMPILE’ the loaded source code FILE (to create a useable User Defined ‘unit’ from it), I get ONE Compiler Error. The compiler error reads as follows:

   (8,47) Fatal: Can't find unit Graphics used  by  <sourcecodeFILE>    .

The word ‘Graphics’ appears once and only once in the entire copied source code FILE. It appears near the top of the source code in a ‘uses’ statement. Apparently, ‘Graphics’ is supposed to be a standard ‘unit’ that is part of the Delphi language. For some reason, the FPC free pascal compiler (which was ‘OPTIONS’ -set to compile the source code as Delphi ) can’t locate the code to suppport the ‘uses’ statement that specifically calls out a ‘unit’ called ‘Graphics’.

MY QUESTION:

Can anybody tell me HOW to resolve this Compiler Error ??

Hi guys! I have been working on finding the answer to my posted question and I have discovered a few things about the FPC free pascal version (at freepascal.org) that I downloaded.

In order to compile-and-run the included ‘Delphi-language’ source code (specifically, the file called ‘K8061dmo.PAS’) that comes with the K8061 USB Interface Kit, your IDE Programming Language Environment has to have ALL of the following ’ ???.ppu ’ files:

windows.ppu
messages.ppu
sysutils.ppu
classes.ppu
graphics.ppu
controls.ppu
forms.ppu
dialogs.ppu
stdctrls.ppu
extctrls.ppu
comctrls.ppu
math.ppu
buttons.ppu

… in order to match up with each of the ‘units’ indicated in the following ‘uses’ statement: …

uses
’ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
’ ComCtrls, Math, Buttons;

… ONLY FIVE of these ‘units’ are present (in a subfolder called 'units\i386-win32\rtl ') as follows:

windows.ppu
messages.ppu
sysutils.ppu
classes.ppu
math.ppu .

… In the version of FPC free pascal that I downloaded, the following ‘units’ are not present:

graphics.ppu
controls.ppu
forms.ppu
dialogs.ppu
stdctrls.ppu
extctrls.ppu
comctrls.ppu
buttons.ppu .

SO, therefore, I have to modify my originally posted question, as follows:

Updated Modified Question:

Which downloadable version (and/or language variant) do I have to download (at freepascal.org) in order to guarantee that the following ’ ???.ppu ’ files are included (?):

graphics.ppu
controls.ppu
forms.ppu
dialogs.ppu
stdctrls.ppu
extctrls.ppu
comctrls.ppu
buttons.ppu .

(NOTE: Once ^this answer^ is determined, then FPC free pascal can run-and-compile the ‘Delphi’ source code that comes with the K8061 USB Interface Kit. Of course, you also have to tell the FPC compiler to use ‘Delphi’ compilation when compiling. I would ask the FPC people but they do not have a support staff.)

I’ve created a file for you that correctly defines the functions for the K8061.dll:
http://www.velleman.eu/images/tmp/K8061.pas

It does not use any of the functions, that’s up to you