Re: [fpc-pascal] Re: WSAGetLastError returns 0 when it shouldn't but I cannot see why
En/na L ha escrit: Found the problem using my brute force writeln('') skills. It is an issue with freepascal's stack or something to do with buggy threads methinks. As it is when you call lasterror within another procedure with local variables.. they are corrupted or something. Aha.. I changed the by Value parameter to a CONST parameter in the error procedure (Perror).. And this solves the issue.. So something to do with calling by Value within a thread versus a const (pointer?). This seriously worries me, since I use threads extensively, and I mostly use call by value parameters. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Externalization and inclusion of .PAS files (with GTK+) ?
Please don't think in PHP or C when you use Pascal... in C the compiler passes multiple times to be able to map between every line of code and locate things on other includes. The pascal's compiler does not include full units inside a big unit. it includes sub implementations: types.inc type MyInt = type longint; // end of include file main.pas unit main; interface ... {$include types.inc} ... implementation ... end. Please note that if you place things out of order, that is include/declear a function before you included types, and that function uses MyInt, the compiler will not be able to find the type you wish to use. Ido On Thu, Feb 28, 2008 at 1:22 PM, T. Guilleminot <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like to simplify my programs by creating a short MAIN.PAS file and > several additional .PAS files called inside. > So I'd like to deport most of my code (procedures, functions...) to these > external .pas files and include them into the main.pas, a kind of > "include"-like in PHP. > > I browsed the doc but between the "{$INCLUDE myfile1.pas}", the "uses" > clause (...) I'm quite lost and it has never worked for me yet. > As I code with GTK+ binding I also get GTK objects problem (eg : "unknown > object"...). > > Does anyone able to provide me a simple example to achieve this ? > Thanks for any answer. > Tom > > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- http://ik.homelinux.org/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Externalization and inclusion of .PAS files (with GTK+) ?
Hi, I'd like to simplify my programs by creating a short MAIN.PAS file and several additional .PAS files called inside. So I'd like to deport most of my code (procedures, functions...) to these external .pas files and include them into the main.pas, a kind of "include"-like in PHP. I browsed the doc but between the "{$INCLUDE myfile1.pas}", the "uses" clause (...) I'm quite lost and it has never worked for me yet. As I code with GTK+ binding I also get GTK objects problem (eg : "unknown object"...). Does anyone able to provide me a simple example to achieve this ? Thanks for any answer. Tom ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: WSAGetLastError returns 0 when it shouldn't but I cannot see why
> This seriously worries me, since I use threads extensively, and I mostly use call by value > parameters. Bye -- Luca I use CONST parameters wherever possible for strings.. so that: 1) if I ever port the code to a DLL it is safer (can cast pchar in) 2) const is a stricter contract 3) performance (ha, premature optimization, by val could be faster sometimes) As for threads.. I hate them. Wherever there is an alternative solution, I use it. Even if the compiler is working okay, threads still suck. For example I don't give a hoot about a threaded ISAPI server being supposedly more performance oriented than CGI - as if performance makes a difference when the program with threads is buggy. A performance friendly buggy program is about as useless as a demented cheetah that smashes into trees every 3 meters. However, with Sockets programming and blocking sockets... threads are unfortunately one known way of handling the blocking socket.. so.. what to do. LNet? Dunno, Haven't tried it much.. have to try it sometime though ;-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Externalization and inclusion of .PAS files (with GTK+) ?
T. Guilleminot wites: So I'd like to deport most of my code (procedures, functions...) to these external .pas files and include them into the main.pas, a kind of "include"-like in PHP. (...) Does anyone able to provide me a simple example to achieve this ? Thanks for any answer. Probably most elegant (though not fully equivalent to PHP) solution I've seen is in fpc's units: unit main; interface uses ... {all units required by main.pas and included.pas in interace part} {$undef read_implementation} {$define read_interface} {$i included.pas} {$undef read_interface} implementation uses ... {all units required by main.pas and included.pas in implementation part} {$define read_implementation} {$i included.pas} {$undef read_implementation} begin end. ... unit included; {$ifdef read_interface} //interface part goes here {$endif read_interface} {$ifdef read_implementation} //implementation part goes here {$endif read_implementation} Hope this helps. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal