On Fri, 28 Nov 2008, Barry Jackson wrote:

Hi Barry,

> More problems.
> There is a "THREAD STATIC s_aPorts"  declaration before the main procedure
> in telepathy.prg and no matter how I build this it always crashes with: 
> Error BASE/1003 Variable does not exist: S_APORTS. Even if I put altd()
> before any other functions in main() it crashes first.
> I have tried changing it to a PUBLIC inside main(). I have tried it without
> the 'THREAD', I have compiled it with -mt but all produce the same result. I
> cannot find any documentation on Harbour variable declarations and scoping
> anywhere. Even a small test program with a STATIC declared before the main()
> procedure cannot see the static variable within the program. As I understand
> it a STATIC declared outside the main procedure should have application wide
> scope - is this correct?

The variable scope is exactly the same as in Clipper and I think also
in xbase++ if it's Clipper compatible. See what -n harbour and Clipper
compiler switch does in Clipper documentation and use it to compiler
your code. All Clipper switches are supported. -n means that compiler
will not generate automatically procedure with the same name as compiled
file which will contain code between start of file and first explicitly
defined user function/procedure.
When it's used then before 1-st function/procedure you can only use
declarations like MEMVAR, FIELD, [THREAD] STATIC and they have file
wide scope.

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to