Home > Back-end >  Questions about Delphi pointer
Questions about Delphi pointer

Time:09-30

Using the Delphi call DLL code below
CThe unit MatRead;

Interface
Type
Pchar=^ AnsiChar;
The function ReadMatSize (path: PChar) : Integer; Cdecl;
Implementation
The function ReadMatSize; External 'MatReadLib. DLL' name 'ReadMatSize';
End.


The unit main;

Interface

USES the
Winapi. Windows, Winapi Messages, System. SysUtils, System. Variants, System. Classes, Vcl. Graphics,
The Vcl. Controls, Vcl. Forms, Vcl. Dialogs, Vcl. StdCtrls;

Type
TForm1=class (TForm)
Testmat: TButton;
Procedure TestmatClick (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;
Tdata: PDouble;

Implementation

{$R *. DFM}
USES the
MatRead;
Procedure TForm1. TestmatClick (Sender: TObject);
Var
S: AnsiString. ArrChar: an array of Char [1.. 1024]. P: PChar;
The begin
S:='E: \ \ test. The mat'; P:=PChar (s);
Size:=ReadMatSize (p);
end;

End.


{size:=ReadMatSize (p); } this line of code Error errors for [dcc32 Error]. The main pas (33) : E2029 '(' expected but:=' found

CodePudding user response:

What is your Size here?

CodePudding user response:

You refers to compile error size: integer you are not yet defined,
Pchar types Delphi bring don't define
Your calling convention is cdecl this appointment with DLL developer divide is usually stdcall

CodePudding user response:

The definition of a variable is size
Used to record the length of the

CodePudding user response:

The
reference 3 floor sinat_16176459 response:
the definition of a variable is the size
Used to record the length of the


This let me say what good, you all know what to do with the size of the variable, you can't please define just add the size: Integer;
 
Procedure TForm1. TestmatClick (Sender: TObject);
Var
S: AnsiString.
ArrChar: an array of Char [1.. 1024]. P: PChar;
Size: Integer;
The begin
S:='E: \ \ test. The mat'; P:=PChar (s);
Size:=ReadMatSize (p);
end;

CodePudding user response:

The Size is the key system, cannot do his definition?

CodePudding user response:

reference 5 floor hongss reply:
Size is the key system, cannot do his definition?



The size is not a keyword, sizeof is, he is not define this question is very simple I posted code the kiss

CodePudding user response:

reference 4 floor xsl510079027 response:
Quote: reference sinat_16176459 reply: 3/f

The definition of a variable is size
Used to record the length of the


This let me say what good, you all know what to do with the size of the variable, you can't please define just add the size: Integer;
 
Procedure TForm1. TestmatClick (Sender: TObject);
Var
S: AnsiString.
ArrChar: an array of Char [1.. 1024]. P: PChar;
Size: Integer;
The begin
S:='E: \ \ test. The mat'; P:=PChar (s);
Size:=ReadMatSize (p);
end;

The size of the error is a problem I didn't pay attention to this program is a compiler success after I RUN but no pop-up more results
  • Related