ich habe ein Programm, indem ich eine procedure als Variblentyp übergeben muss.
Code: Alles auswählen
in include File
type
Trtlsdr_read_async_cb_t = procedure(buf: pbyte; len: Tuint32_t; ctx: pointer); cdecl;
Programm
var
hu: ^byte;
hw: Trtlsdr_read_async_cb_t;
hx: pbyte;
hy: Tuint32_t;
hz: pointer;
buffer: pointer;
Daten_Len: Tuint32_t;
Daten_Adr: pointer;
procedure TForm1.rtlsdr_callback(buf: pbyte; len: Tuint32_t; ctx: pointer);
begin
Daten_Len:=len;
Daten_Adr:=ctx;
move(buffer, buf, len);
end;
procedure main_program;
begin
GetMem(buffer, 262144 * sizeof(byte));
hx:=hu;
hy:=262144;
hz:=buffer;
hw:=rtlsdr_callback(hx, hy, hz); // Zeile wo der Fehler auftritt Zeile 254
end;
Nachrichten, Warnungen: 1
Warning: other unit files search path (aka unit path) of "ADS-B" contains "c:\Lazarus\components\codetools", which belongs to package "CodeTools"
Hint: (11030) Start of reading config file C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Hint: (11031) End of reading config file C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 3.2.2 [2025/01/19] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
(1002) Target OS: Win64 for x64
(3104) Compiling adsb.lpr
(3104) Compiling unit1.pas
E:\RTLSDR\adsb\unit1.pas(254,7) Error: (4001) Incompatible types: got "untyped" expected "<procedure variable type of procedure(PByte;LongWord;Pointer);CDecl>"
unit1.pas(637) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus\fpc\3.2.2\bin\x86_64-win64\ppcx64.exe returned an error exitcode
Wie bekomme ich die procedure rtlsdr_callback in die Variable hw????
Danke und Gruß
Jürgen