Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-09

How to use var or object in a programm file from a unit file

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

yu ping

Program prog1
use unit1
myObj=class
private

public
.....
end;
---------------------------
unit unit1
..............

like above, can i access myObj in unit1?

Reply by email

Michael Van Canneyt
to yu ping
yu ping wrote 13 lines
Program prog1 use unit1 myObj=class private public ..... end; --------------------------- unit unit1 .............. like above, can i access myObj in unit1?

No.

A unit only has access to symbols that appear in units in it's uses clause. The program can never appear in the uses clause of a unit, because a unit can exist without a program.

Michael.

Reply by email

Jeff Wormsley
to yu ping: Program prog1 use unit1 myObj=class private public ..... end; ---------------------------…
yu ping wrote 14 lines
Program prog1 use unit1 myObj=class private public ..... end; --------------------------- unit unit1 .............. like above, can i access myObj in unit1?

Much better to have something like this:

 Program prog1;
 uses CommonStuff, unit1;
..........
 ---------------------------
 unit CommonStuff;
 myObj=class
 private

public
.....
end;
..............
---------------------------
unit unit1
uses CommonStuff;
.......

Jeff.

I haven't smoked for 3 years, 1 month and 1 week, saving $5,105.70 and not smoking 34,038.04 cigarettes.

Reply by email

yu ping
to Unknown author

I just now download indy-10.2.0.3.tar.gz - for Unix/Linux system users. and build success on windows.
the file indy-10.2.0.3.zip - for Windows users. damaged ,can not be decompressed.

when I try to build indy10 files from http://indy.fulgan.com/ZIP/ I get a lot of mistaks:
---------- make ----------
E:/tools/programming/fpc/bin/i386-Win32/ppc386.exe -gl - -Fu../System/lib/i386-win32 -Fu../System -Fi../Inc -FE. -FUlib/i386-win32 -di386 indycorefpc.pas
Free Pascal Compiler version 2.2.4 [2009/04/10] for i386 Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling indycorefpc.pas
Compiling IdIcmpClient.pas
Compiling IdRawHeaders.pas
IdRawHeaders.pas(59,14) Error: There is no method in an ancestor class to be overridden: "TIdSunB.GetBytesLen:DWord;"
IdRawHeaders.pas(61,15) Error: There is no method in an ancestor class to be overridden: "TIdSunB.ReadStruct(const TIdBytes,var LongWord);" ......

2009/9/25 :

Show quoted text 9 lines
Indy 10? It's FPC compatible. Indy 9 not. _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

David Emerson
to yu ping

Maybe you'll have an easier time with either Synapse or Lnet. I don't know if either of them have the functionality you need, but I had a pretty easy time getting them both working on linux.

http://lnet.wordpress.com/
http://sourceforge.net/projects/synalist/

yu ping wrote
I just now download indy-10.2.0.3.tar.gz - for Unix/Linux system

users.

Show quoted text 38 lines
and build success on windows. the file indy-10.2.0.3.zip - for Windows users. damaged ,can not be decompressed. when I try to build indy10 files from http://indy.fulgan.com/ZIP/ I get a lot of mistaks: ---------- make ---------- E:/tools/programming/fpc/bin/i386-Win32/ppc386.exe -gl - -Fu../System/lib/i386-win32 -Fu../System -Fi../Inc -FE. -FUlib/i386-win32 -di386 indycorefpc.pas Free Pascal Compiler version 2.2.4 [2009/04/10] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Target OS: Win32 for i386 Compiling indycorefpc.pas Compiling IdIcmpClient.pas Compiling IdRawHeaders.pas IdRawHeaders.pas(59,14) Error: There is no method in an ancestor class to be overridden: "TIdSunB.GetBytesLen:DWord;" IdRawHeaders.pas(61,15) Error: There is no method in an ancestor class to be overridden: "TIdSunB.ReadStruct(const TIdBytes,var LongWord);" ...... 2009/9/25 : > > Indy 10? It's FPC compatible. > > Indy 9 not. > > _______________________________________________ > fpc-pascal maillist  -   > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email