I have a library of Delphi wrappers for some DLLs that I use, and I am converting them for use in Lazarus. In the interface of the Lazarus wrapper unit, I declare a function -- for example
function sdDisplaySampling
(Ch1Enabled: Bool; Ch2Enabled: Bool;
TriggerSource: Word; Timebase: Word;
BufferSize: Word; var Time: Double): DOUBLE
stdcall;
The code for this function is included in the DLL "SDKDLL.DLL", so in the implementation section of the wrapper I write:
function sdDisplaySampling: external 'SDKDLL.DLL';
This generates a compiler error. On the other hand, if I recreate the entire function declaration in the implementation section, and add the external clause, as in:
function sdDisplaySampling
(Ch1Enabled: Bool; Ch2Enabled: Bool;
TriggerSource: Word; Timebase: Word;
BufferSize: Word; var Time: Double): DOUBLE
stdcall; external 'SDKDLL.DLL'
This compiles fine.
Can anyone confirm that this last form, with the entire function definition re-created in both the interface and implementation sections, is going to work at run-time? If that's right, I'd like to include a note to this effect in the "converting Delphi to Lazarus" wiki.