Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi how can I call a function with parameter record in another unit ? (https://www.delphipraxis.net/153330-how-can-i-call-function-parameter-record-another-unit.html)

obiwankby 29. Jul 2010 12:00

how can I call a function with parameter record in another unit ?
 
Hi,

How can I call a function with parameter record in another unit?

For example:
TGrUser = record
Name : string [20];
Descr : string [100];
R1 : boolean;
end;

function fGrUser(sS:string;writeUser: TGrUser);
begin
...
end;

If I call the function in the unit1 where is create type record and function it work; if I call the function from unit2 I have the message error: "E2010 incompatible types ...".

The type record from unit2 is declarated in unit2.

bye

ObiWanKby

cherry 29. Jul 2010 12:23

AW: how can I call a function with parameter record in another unit ?
 
is the type declared twice?
if yes, try to declare it only in one unit!

DeddyH 29. Jul 2010 12:47

AW: how can I call a function with parameter record in another unit ?
 
That' s it. You can either declare the type in the interface-section of one of your units or create a separate unit for this type, which you add in both "uses"-clauses.


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:44 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz