[fpc-pascal]Synapse for FPC
memsom at interalpha.co.uk
Thu Jul 24 11:21:23 CEST 2003
> I would prefer a language that is tightly integrated with an OS... so
> that OS calls and language calls fit together in one smooth flow. I should
> have to translate strings or use trickery like "A := B+A+#0" or "@A" to
> things to work. OS calls should be so seamless as to appear to be part of
> language, not part of yet another complex bag of tricks that has to be
> and understood.
In most cases, casting an ansistring as pchar will work. The only caveat is
when Windows wants to alter the variable you pass' contenets.
MessageBox( pchar(MyMessage), 'test', MB_OK);
GetUserName( pchar(Username), 255 ); //error!!!
Username: array[0..255] or char;
GetUserName( Username, 255 ); //This works!!
This, however, is how Delphi does it, so you may find that your mileage
varies. For example, the second GetUserName example my require an
> I'm not saying you should mask API calls to make them look like Pascal
> Just the opposite, I'm thinking it might be better to bend Pascal to work
> better with the OS... Make it natively work with null terminated strings
> windows, give it the same numerical structures as BEOS, support LINUX file
> handling in Pascal's normal file handlers, etc.
Most OS have similar concepts; they just accomplish things in different ways
(e.g. Linux devices are all file descriptors, but BeOS devices are almost
all file descriptors, and Windows Devices are not.) Wrapping up the
differences is the smart way of making sure your skills are transferable.
More information about the fpc-pascal