I'm running into this string problem as well. I'd like to use strings longer than 255 but I get strange errors like:
[EMAIL PROTECTED] seq-bayes]$ fpc mcmc3pl.pas Free Pascal Compiler version 1.0.6 [2002/05/23] for i386 Copyright (c) 1993-2002 by Florian Klaempfl Target OS: Linux for i386 Compiling mcmc3pl.pas Assembling mcmc3pl Linking mcmc3pl mcmc3pl.o: In function `_READ_CONFIG$INTEGER$INTEGER$STRING$STRING': mcmc3pl.o(.text+0x147): undefined reference to `FPC_READ_TEXT_LONGSTR' mcmc3pl.o(.text+0x17c): undefined reference to `FPC_VAL_SINT_LONGSTR' mcmc3pl.o(.text+0x243): undefined reference to `FPC_READ_TEXT_LONGSTR' mcmc3pl.o(.text+0x278): undefined reference to `FPC_VAL_SINT_LONGSTR' mcmc3pl.pas(215) Error: Error while linking Closing script ppas.sh [EMAIL PROTECTED] seq-bayes]$ fpc test_string500 Free Pascal Compiler version 1.0.6 [2002/05/23] for i386 Copyright (c) 1993-2002 by Florian Klaempfl Target OS: Linux for i386 Compiling test_string500.pas test_string500.pas(15,13) Fatal: Internal error 8888 These errors disappear when I edit the string definitions back to length 255 or less. Should I just avoid using longer strings or is there a compiler switch I have to include? Or is there a tutorial on FPC strings (I never used Delphi much)? Or is this behavior fixed in 1.0.10? -Alan --- Matt Emson <[EMAIL PROTECTED]> wrote: > > Yes and no. Why is it so bad to write a function in that way ? It > could > > of course be written two different ways, but I'd rather this way > where I > > modify the string passed to the function. > > > > Explain it to me :) (I'm the only one that works on this project > of > > ~30,000 LOC, so I don't see any problem) > > Turbo Pascal and Delphi 1 had a type called 'String'. This was > limited to > 255 chars, size of 256 chars, and position 0 holds the strings > length. > Delphi 2+ has a type called shortstring that behaves in exactly the > same way > as the old style string. > > Delphi 2+ altered the string type to be a pointer to a chunk of > memory, and > added a whole load of compiler magic to make strings automatically > grow and > shrink, added reference counting and 'copy of change' functionality > (the > last two to aid in not having to copy a string until someone alters > it.) > This is where your problem lies. > > Because FPC mimics Delphi string functionality, basically you'll > end up with > similar results. > > You'd be much better off Returning a value, and thereby avoiding > the > potential for big allocation/deallocations. That or use > shortstrings. > > Matt > > > > _______________________________________________ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal