On Sun, 09 Nov 2008, Szak�ts Viktor wrote:

Hi Viktor,

> I like the second one better, as it clears the ambiguity
> and even the requirement to use -n switch when someone
> defines MAIN(). So there would be one thing less to worry
> about. First choice however is more Clipper compatible,
> so IMO we should do it.

Please remember that current support for startup function
is a hack which works only with few C compilers and even
for them does not work correctly in all cases and we had
to add yet another hack: -n1 switch which disable it for
DLLs because DLL functions where registered before normal
functions and 1-st dll function was used as startup one.
Now we have two different behaviors which may cause portability
problems for Harbour code and this is probably even bigger
problem then strict Clipper compatibility.
This problem cannot be resolved at compile time. To make it
well we need linker wrapper which will extract first Harbour
function from linked modules and mark it as startup one.
I added such functionality to hb* scripts and this is the
only one method which works in all conditions and does not
dependent on the order of init code execution.
Anyhow it works only for GCC. For backward compatibility
with older Harbour code I gave main() higher priority then
1-st linked function but it can be removed. This feature
exists for many years and works well. So far no one reported
that it's a problem. I think it should be default for all
platforms/C compilers.
BTW If we want to keep -n1 then it should be changed to -n2
and simply -n1 should be the same as -n and -n0 should work
like -n- to make it compatible with other switches.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to