'SetWireInValue' does not exist (from delphi)


#1

Ok so here’s a weird one. I’m upgrading a delphi project to support the latest okFrontPanel.dll (because the application is going 64 bit).
Everything worked with the old okFrontPanel.dll. But after dropping in the new DLL and updating the delphi wrapper unit, I get an error pop up saying "THe procedure entry point okFrontPanel_SetWireInValue could not be located in the dynamic link library okFrontPanel.dll.
I’ve checked and triple checked that I’m using the write dll in the right folder (When I delete okfrontpanel.dll the error changes to can’t find the dll, put it back and I get my original error).
Everything is 32 bit. Other functions in the dll are being called without complaint (see code below). It only seems to be this one function.
Can anyone give me the correct definition of okFrontPanel_SetWireInValue (C++ and/or delphi)?

I have distilled this down as much as I can, but here’s the zen of it:

---- The C definition from the latest .h file

okDLLEXPORT ok_ErrorCode DLL_ENTRY okFrontPanel_SetWireInValue(okFrontPanel_HANDLE hnd, int ep, unsigned long val, unsigned long mask);

---- The old Delphi line that references that function

function okUsbFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep, val, mask: Integer): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

---- What appears to be the correct new delphi line based on the .h file definition

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep: Integer; val, mask: UInt64): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

---- Other lines I’ve tried:

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep: Integer; val, mask: UInt64): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep: Integer; val, mask: Integer): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep: Integer; val, mask: UInt32): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep: Integer; val, mask: LongWord): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep, val, mask: LongWord): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep, val, mask: UInt32): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

function okFrontPanel_SetWireInValue(hnd: okUSBFRONTPANEL_HANDLE; ep, val, mask: UInt64): ok_ErrorCode; stdcall; external ‘okFrontPanel.dll’;

---- Delphi defs
okUSBFRONTPANEL_HANDLE = Pointer (equivalent to void* in the documentation)
ok_ErrorCode is an enum (so Integer) that conforms to

---- Begin Delphi Console App ----

program WillTestArea1;
{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils,
okFrontPanel;
var
hnd : Pointer;
ep : Integer;
val : Cardinal;
mask : Cardinal;
begin

readln;
writeln(‘Start.’);
hnd := NIL;
try
hnd := okFrontPanel_Construct();
writeln(okFrontPanel_IsHighSpeed(hnd));
ep := $00;
val := $00FF;
mask := $FFFF;

okFrontPanel_SetWireInValue(hnd, ep, val, mask);

except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
if(hnd <> NIL) then
okFrontPanel_Destruct(hnd);

readln;
writeln(‘End of line.’);
end.

----- End Delphi Console App


#2

NOTE: Also tried a couple of Cardinal variations.


#3

William-
Are you aware of the COFF vs OMF file types for the static and dynamic library files?
I upgraded my IDE to the latest C++ Builder 10.2 and can no longer use the Opal Kelly API as it will not compile and link into my app due to the COFF vs OMF compatibility issue.

When I first received my first OK board I had an older C++ Builder version, and I was able to compile and link and was controlling the LEDs on the board with my code in an hour or so.

But once I upgraded (losing the older version), it became unusable.

So my question to you: are you using a file formal conversion with Delphi to make the libraries compatible? I had no luck with that and have had to resort to MSVS C# to move my project ahead. I would prefer the productivity of CPPB, but I can’t figure out how to make it work. (the COFF to OMF conversion utilities are not effective)
Any ideas welcomed.