[Lazarus] Lazarus 2.0 doesn't compile LabJack wrapper

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Lazarus 2.0 doesn't compile LabJack wrapper

Free Pascal - Lazarus mailing list
Hi,

we control some laboratory equipment with a LabJack U3-HV interface. The
manufacturer of the interface provided a dll file and a Delphi wrapper
for the dll file to read and set the ports of the interface. This works
well with Delphi XE2.

But when I try to migrate to Lazarus 2.0, this wrapper is not accepted.
It appears a error message 'Calling convention doesn't match forward'.
Delphi XE2 doesn't complain about any convention difficulties in the
wrapper file. I tried to harmonize the calling convention prescriptions
in the interface and the implementation part of the wrapper- no success.

Is this a Lazarus or FPC bug, or a (perhaps undocumented)
incompatibility between Delphi XE2 and Lazarus 2.0? Or do I oversee
something? We are using Win 10, Version 1809 (64). The wrapper itself 
can be downloaded from
http://transfer.joepgen.com/wrapper.pas

Regards --  Joe



--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0 doesn't compile LabJack wrapper

Free Pascal - Lazarus mailing list
The implementation part is missing "stdcall;"
You also need to match the parameters and return types of functions
between interface and implementation parts.
Actually the implementation part is not needed (I think). Just give
the external DLL name in the interface.

Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0 doesn't compile LabJack wrapper

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Thu, 7 Mar 2019 00:53:32 +0100
Joe via lazarus <[hidden email]> wrote:

> Hi,
>
> we control some laboratory equipment with a LabJack U3-HV interface.
> The manufacturer of the interface provided a dll file and a Delphi
> wrapper for the dll file to read and set the ports of the interface.
> This works well with Delphi XE2.
>
> But when I try to migrate to Lazarus 2.0, this wrapper is not
> accepted. It appears a error message 'Calling convention doesn't
> match forward'. Delphi XE2 doesn't complain about any convention
> difficulties in the wrapper file. I tried to harmonize the calling
> convention prescriptions in the interface and the implementation part
> of the wrapper- no success.

Have you tried compiling with {$mode delphi} instead of {$mode objfpc}?

 
> Is this a Lazarus or FPC bug, or a (perhaps undocumented)
> incompatibility between Delphi XE2 and Lazarus 2.0?

It is documented. For example:
https://www.freepascal.org/docs-html/prog/progse74.html

> Or do I oversee
> something? We are using Win 10, Version 1809 (64). The wrapper
> itself can be downloaded from
> http://transfer.joepgen.com/wrapper.pas

Mattias
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0 doesn't compile LabJack wrapper

Free Pascal - Lazarus mailing list
Am 07.03.2019 um 08:33 schrieb Mattias Gaertner via lazarus:
> Have you tried compiling with {$mode delphi} instead of {$mode objfpc}?
The wrapper did not contain any '{$mode objfpc}' or '{$mode delphi}'
instruction. I inserted '{$mode delphi}', and the wrapper could be
compiled. Thanx, Mattias.

--  Joe
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus 2.0 doesn't compile LabJack wrapper

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 07.03.2019 um 08:24 schrieb Juha Manninen via lazarus:
> Actually the implementation part is not needed (I think). Just give
> the external DLL name in the interface.

Interesting approach. I'll try this.
Thanx, Juha.

-- Joe
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus