@c Copyright (C) 1996-2002 Free Software Foundation, Inc.
@c For copying conditions, see the file gpc.texi.
@c This file is part of the GPC Manual.
@c
@c Authors: Russ Whitaker <russ@ashlandhome.net>
@c          J.J. van der Heijden <j.j.vanderheijden@student.utwente.nl>
@c          Frank Heckenbach <frank@pascal.gnu.de>
@c          Peter Gerwinski <peter@gerwinski.de>
@c
@c Last modification: 2002-05-10 (file up to date)

@include macros.texi

@ifclear FAQONLY
@node FAQ
@chapter The GNU Pascal Frequently Asked Questions List.
@subheading Edition 0.9, August 2000
@cindex FAQ
@cindex Frequently Asked Questions
@cindex Questions, Frequently Asked
@end ifclear

@ifset FAQONLY
@include version.texi
@c Note: The following line gets inserted into the destination file,
@c       it does not apply to this Texinfo file!
This file was generated automatically from faq.texi.@*
@sc{DO NOT CHANGE THIS FILE MANUALLY!}

@settitle GPC Frequently Asked Questions List
@node Top
@top The GNU Pascal Frequently Asked Questions List, Edition 0.9, August 2000
@raisesections

This document is a part of the GPC documentation. To make, copy and
distribute modified versions of this document please see the GPC
documentation.
@end ifset

This is the Frequently Asked Questions List (FAQ) for GNU Pascal. If
the FAQ and the documentation do not help you, you have detected a
@strong{bug} in it which should be reported, @ref{Mailing List}.
Please really do it, so we can improve the documentation.

@menu
* GNU Pascal::          GNU Pascal
* Installing GPC::      Installing GPC
* GPC on DJGPP::        GNU Pascal on the DJGPP (MS-DOS) platform
* Strings in GPC::      Strings
* Getting Help::        Getting Help
* Miscellaneous FAQ::   Miscellaneous
@end menu

@node GNU Pascal
@section GNU Pascal

@menu
* What and why::                What and why?
* Current version::             What is the current version?
* Turbo Pascal compatibility::  Is it compatible with Turbo Pascal (R)?
* Supported platforms::         Which platforms are supported by GNU Pascal?
@end menu

@node What and why
@subsection What and why?

@include purpose.texi

@node Current version
@subsection What is the current version?

Prior to July 2000 releases were several months apart. Since then
there has been a new release every few days, available as a source
archive
@c or from a CVS server
from the GPC web site, @uref{http://www.gnu-pascal.de}.

For details about new features, see the section @samp{News} on the
web site. On bugs fixed recently, see the @samp{Done} section of the
To-Do list (on the same web site).

GPC uses GCC as a back-end. Patches for GCC 2.8.1 and GCC 2.95.x are
provided but it is recommended that you use GCC 2.95.x.

@node Turbo Pascal compatibility
@subsection Is it compatible with Turbo Pascal (R)?

GPC is not a drop-in replacement for Borland's Turbo Pascal (R).
Almost all BP language features are supported. Notable exceptions
are the string format (as discussed below), or the @samp{Mem} and
@samp{Port} pseudo arrays, though replacement functions for the
latter on IA32 platforms exist in the @samp{Ports} unit.

Almost all of BP's run time library is supported in GPC, either by
built-in compiler features or in units with the same names as their
BP counterparts.

For details about the compatibility, the few remaining
incompatibilities and some useful alternatives to BP features, see
the @samp{Borland Pascal} chapter in the GPC Manual.
@ifclear FAQONLY
(@pxref{Borland Pascal})
@end ifclear

@node Supported platforms
@subsection Which platforms are supported by GNU Pascal?

GPC uses the GCC backend, so it should run on any system that is
supported by GNU CC. This includes a large variety of Unix systems,
MS-DOS, OS/2 and Win32. A full list of platforms supported by GCC
can be found in the file @file{INSTALL} of the GCC distribution. Not
all of these have actually been tested, but it is known to run on
these platforms:

@multitable @columnfractions .4 .6
@item        ix86-linux                 @tab (Linux 2.x, ELF)
@item        i486-linuxaout
@item        i486-linuxoldld
@item        i386-freebsd1.2.0
@item        AIX 4.2.1
@item        AIX 4.3
@item        DJGPP V2                   @tab (Dos)
@item        EMX 0.9B                   @tab (OS/2, Dos)
@item        Cygwin32 beta20 and higher @tab (MS-Windows95/98, MS-Windows NT)
@item        mingw32                    @tab (MS-Windows95/98, MS-Windows NT)
@item        mips-sgi-irix5.3
@item        mips-sgi-irix6.5
@item        sun-sparc-sunos4.1.4
@item        sparc-sun-solaris2.x
@item        sun-sparc-solaris 2.5.1
@item        sun-sparc-solaris 2.6
@item        sun-sparc-solaris 7
@item        sun-sparc-solaris 8
@item        alpha-unknown-linux
@item        alpha-dec-osf4.0b
@item        s390-ibm-linux-gnu
@end multitable

@strong{OK people -- send us your success stories, with canonical machine name!}

@node Installing GPC
@section Installing GPC

You find the most up-to-date installation instructions in the GPC
Manual or the file @samp{INSTALL} in source distributions, or on the
GPC web site.
@ifclear FAQONLY
(@pxref{Installation})
@end ifclear

The following sections describe things you might need or want to
install besides GPC itself.

@menu
* Documentation files::  What to read next
* Components::           Which components do I need to compile Pascal code?
* Debugger::             How do I debug my Pascal programs?
* Libraries::            What additional libraries should I have?
* Contributed units::    Contributed units
* IDE::                  Can you recommend an IDE?
@end menu

@node Documentation files
@subsection What to read next

After installing GPC, please check the files in the directory
@file{/usr/local/doc/gpc}:

@multitable @columnfractions .25 .75
@item @file{README}      @tab General Information about GPC
@item @file{FAQ}         @tab This FAQ :@minus{})
@item @file{NEWS}        @tab Changes since the last release
@item @file{BUGS}        @tab How to report bugs, about the Test Suite
@item @file{AUTHORS}     @tab List of GPC authors
@item @file{COPYING}     @tab The GNU General Public License
@item @file{COPYING.LIB} @tab The GNU Lesser General Public License
@end multitable

@node Components
@subsection Which components do I need to compile Pascal code?

A complete Pascal compiler system should at least have:

@enumerate
@item The actual compiler, GPC.

@item An editor, assembler, linker, librarian and friends.

@item A C library. If you have a working C compiler, you already
have this.

@item A debugger, if you want to debug your programs.
@end enumerate

For most people, the GNU binutils and GNU debugger (@samp{gdb}) are
a good choice, although some may prefer to use vendor specific
tools.

@node Debugger
@subsection How do I debug my Pascal programs?

To debug your programs, (a) GNU Pascal must be able to generate
executables with debug info for your platform, and (b) you must have
a debugger which understands this.

@itemize @bullet
@item
If @samp{gpc -g -o hello hello.p} says:
@example
gpc: -g not supported for this platform
@end example
then GPC is unable to generate debugging info. Usually, installing
@samp{gas} (part of GNU binutils) instead of your system's assembler
can overcome this. When you configure the GCC used for GPC, specify
@samp{--with-gnu-as}, and possibly @samp{--with-gnu-ld} and/or
@samp{--with-stabs}. More information can be found in the
@file{INSTALL} file in the GNU CC source directory.

@item
Your system's debugger may not understand the debug info generated
by GNU tools. In this case, installing @samp{gdb} may help.
@end itemize

The bottom line: if you can debug GCC compiled programs, you should
be able to do this with GPC too.

The GNU debugger (@samp{gdb}) currently does not have a ``Pascal''
mode, so it is unable to display certain Pascal structures etc. When
debugging, please note that the Initial Letter In Each Identifier Is
In Upper Case And The Rest Are In Lower Case. If you want to display
variable @samp{foo} in the debugger, type @samp{show Foo} or
@samp{display Foo} instead.

Although @samp{gdb} is an excellent debugger, it's user interface is
not everybody's preference. If you like to debug under X11, please
refer to the comp.windows.x FAQ:
``Where can I get an X-based debugger?'' at:@*
@uref{http://www.cis.ohio-state.edu/hypertext/faq/usenet/x-faq/part6/faq-doc-2.html}

Some useful frontends include: XXGDB, tGDB and XWPE. See:@*
@uref{http://www.ee.ryerson.ca:8080/~elf/xapps/Q-IV.html}

Very nice, but resource consuming is the Motif based DDD:@*
@uref{http://sol.ibr.cs.tu-bs.de/softech/ddd/}

Furthermore, RHIDE (@pxref{IDE}) contains built-in debugging suport,
similar to the IDE of BP.

@node Libraries
@subsection What additional libraries should I have?
@cindex libraries
@cindex gmp
@cindex rx
@cindex ncurses
@cindex PDCurses
@cindex ElectricFence
@cindex efence

@include libs.texi

@node Contributed units
@subsection Contributed units
@cindex contributed units
@cindex units, contributed

Several people have contributed units for GPC. They are usually
announced on the mailing list, @ref{Mailing List}. Most of them can
be found in @uref{http://www.gnu-pascal.de/contrib/}.

@node IDE
@subsection Can you recommend an IDE?
@cindex IDE

Users of Borland Pascal may wonder if there's a replacement for the
IDE (Integrated Development Environment). Here's a few suggestions:

@itemize @bullet
@cindex emacs
@cindex xemacs
@item (X)Emacs. Some people think it's the answer to the question of
Life, the Universe and Everything, others decide it's uGNUsable.
Available from your friendly GNU mirror and most distributions.

@cindex RHIDE
@item RHIDE. DJGPP users might want to try RHIDE. The latest (beta)
release is compatible with GNU Pascal and allows stepping, tracing
and watching like Borland's IDE. It can be downloaded from
@uref{http://www.tu-chemnitz.de/~sho/rho/rhide/rhide.html}.

@cindex PENG
@item PENG. It's not free software, but it was written with GPC.
It's very similar to Borland's IDE, but with many extensions.
Binaries for DJGPP, Linux and Solaris can be downloaded from
@uref{http://fjf.gnu.de/peng/}.

@cindex xwpe
@item XWPE is another imitation of the Borland IDE, so users of
Borland Pascal may find it a good alternative.
@end itemize

@node GPC on DJGPP
@section GNU Pascal on the DJGPP (MS-DOS) platform

This chapter discusses some potential problems with GNU Pascal on
MS-DOS, using DJGPP.

@menu
* What is DJGPP::            What is DJGPP?
* DJGPP FAQ::                If you need more information
* DJGPP download::           What do I download?
* Installing GPC on DJGPP::  How do I install the compiler?
* DJGPP Info reader::        I cannot read the Info documentation!
* DJGPP DPMI server::        GPC says: no DPMI
* Assembler syntax::         I have troubles with assembly code
* DJGPP specific code::      Tell me how to do DPMI, BIOS and
                             other DOS related things.
* Stack size::               I got an exception when accessing an
                             @samp{array [1 .. 4000000] of Byte}.
@end menu

@node What is DJGPP
@subsection What is DJGPP?

The following paragraph is from the site
@uref{http://www.delorie.com/djgpp/}:

DJGPP is a complete 32-bit C/C++ development system for Intel 80386
(and higher) PCs running DOS. It includes ports of many GNU
development utilities. The development tools require a 80386 or
newer computer to run, as do the programs they produce. In most
cases, the programs it produces can be sold commercially without
license or royalties.

@node DJGPP FAQ
@subsection If you need more information

GPC/DJGPP is a DJGPP V2 application, and most of the DJGPP
documentation applies for GPC too. A great source of information is
the DJGPP FAQ:
@uref{http://www.delorie.com/djgpp/v2faq/230b.zip}

Another place to look for DJGPP documentation is the DJGPP Knowledge
Base, at this URL:
@uref{http://www.delorie.com/djgpp/doc/kb/}

@node DJGPP download
@subsection What do I download?

As discussed in @ref{Components}, other than GPC itself, you need an
assembler, linker and friends, a C library and possibly a debugger.
The site @uref{http://www.delorie.com/djgpp/} recommended the
following files and they will help you find a mirror:

@multitable {xxxxxxxxxxxxxxxxxxxxx}  {xxxxxxxxxxxxxxxxxxx}
@item  @file{v2/djdev203.zip}    @tab (C library)
@item  @file{v2gnu/bnu2951b.zip} @tab (assembler, @dots{})
@item  @file{v2gnu/gcc2952b.zip} @tab (gcc)
@item  @file{v2gnu/gdb418b.zip}  @tab (debugger)
@item  @file{v2gnu/mak379b.zip}  @tab (make)
@item  @file{v2gnu/txi40b.zip}   @tab (texi)
@end multitable

This list is about 10 MB not counting GPC. You can use a binary
version of GPC from the web site.

@node Installing GPC on DJGPP
@subsection How do I install the compiler?

If you don't have DJGPP installed on your harddisk, create a
directory for GNU Pascal (@file{c:\gpc}), and unzip the archives.
Make sure you preserve the directory structure (use
@samp{pkunzip -d}). Now, add the directory where @file{gpc.exe}
lives (@file{c:\gpc\bin}) to your path and set the DJGPP environment
variable to point to your @file{djgpp.env} file:

@example
set DJGPP=c:\gpc\djgpp.env
@end example

Then, add this to your @file{djgpp.env} file:

@example
---------------------------------------------------------
[gpcpp]
C_INCLUDE_PATH=%/>;C_INCLUDE_PATH%%DJDIR%/lang/pascal;%DJDIR%/include

[gpc]
COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin
LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib;%DJDIR%/contrib/grx20/lib
---------------------------------------------------------
@end example

The binary distribution should come with a @file{djgpp.env} which is
already modified, so you may not have to do this.

The GPC online documentation is in GNU info format; you need the
Info reader (@file{txi390b.zip}) to read it, or use the built-in
Info reader of the RHIDE or PENG IDE. To add the GPC documentation
to the info directory file, edit the @file{c:\gpc\info\dir} file,
and locate this section:

@example
---------------------------------------------------------
* GCC: (gcc.inf).
The GNU C, C++, and Objective-C Compiler

* GDB: (gdb.inf).
The GNU Debugger (gdb and gdb-dpmi).

---------------------------------------------------------
@end example

To add GPC, change it to look like this:

@example
---------------------------------------------------------
* GCC: (gcc.inf).
The GNU C, C++, and Objective-C Compiler

* GPC: (gpc.inf).
The GNU Pascal Compiler

* GDB: (gdb.inf).
The GNU Debugger (gdb and gdb-dpmi).

---------------------------------------------------------
@end example

Specific information for low-memory conditions and more can be found
in the DJGPP FAQ and documentation.

@node DJGPP Info reader
@subsection I cannot read the Info documentation!

To read the Info documentation, you need the @samp{info} program
from @file{txi390b.zip} or an IDE like RHIDE or PENG.

@node DJGPP DPMI server
@subsection GPC says: no DPMI

You don't have a DPMI server installed, and DJGPP v2 requires it to
run. You can either use one of the commercial DPMI servers (e.g.,
run @samp{gpc} in a DOS box under MS-Windows) or download and
install CWSDPMI (@file{csdpmi3b.zip}) which is a free DPMI server
written for DJGPP.

@node Assembler syntax
@subsection I have troubles with assembly code

The GNU Assembler (@file{as.exe}), or @file{gas}, called by GCC
accepts ``AT&T'' syntax which is different from ``Intel'' syntax.
Differences are discussed in section 17.1 of the DJGPP FAQ.

A guide is available which was written by Brennan Mr. Wacko
Underwood @email{brennan@@mack.rt66.com} and describes how to use
inline assembly programming with DJGPP, at this URL:
@uref{http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html}

There's also a GPC assembler tutorial at@*
@uref{http://www.gnu-pascal.de/contrib/misc/gpcasm.zip}

Section 17.3 of the DJGPP FAQ discusses some methods to convert
``Intel'' syntax to ``AT&T'' syntax.

However, please note that assembler code is unportable, i.e. it will
work on IA32 (``x86'') and compatible processors if written for
them, but will not even compile for other processors. So by writing
assembler code in your programs, you will limit their usefulness
substantially.

If you think you ``need'' assembler code for speed -- and you've
checked that your assembler code actually runs faster than Pascal
code compiled with suitable optimizations -- you might want to put
both Pascal and assembler versions of the critical sections in your
program, and let, e.g., an @samp{@{$ifdef i386@}} decide which one
to use. This way, your program will at least compile on all
processors.

@node DJGPP specific code
@subsection Tell me how to do DPMI, BIOS and other DOS related things.

DPMI, BIOS and other functions are no different than other system
functions. Refer to the GPC Manual on how to access your system's
C-library. This small example shows how to use DPMI, copying some
structures and function prototypes of @samp{<dpmi.h>}:

@example
program DPMIDemo;

@{ Only for DJGPP @}

@{$X+@}

@{ `Byte' is `unsigned char' in C,
  `ShortCard' is `unsigned short' in C,
  `MedCard' is `unsigned long' in C,
  `Word' is `unsigned' in C,
  etc. (all these types are built-in). @}

type
  TDpmiVersionRet = record
    Major     : Byte;
    Minor     : Byte;
    Flags     : ShortCard;
    CPU       : Byte;
    Master_PIC: Byte;
    Slave_PIC : Byte;
  end;

type
  TDpmiFreeMemInfo = record
    LargestAvailableFreeBlockInBytes,
    MaximumUnlockedPageAllocationInPages,
    MaximumLockedPageAllocationInPages,
    LinearAddressSpaceSizeInPages,
    TotalNumberOfUnlockedPages,
    TotalNumberOfFreePages,
    TotalNumberOfPhysicalPages,
    FreeLinearAddressSpaceInPages,
    SizeOfPagingFilePartitionInPages,
    Reserved1,
    Reserved2,
    Reserved3: MedCard;
  end;

function DpmiGetVersion (var Version: TDpmiVersionRet): Integer;
         asmname '__dpmi_get_version';

function DpmiGetFreeMemoryInformation
         (var MemInfo: TDpmiFreeMemInfo): Integer;
         asmname '__dpmi_get_free_memory_information';

var
  Version: TDpmiVersionRet;
  MemInfo: TDpmiFreeMemInfo;

begin
  if DpmiGetVersion (Version) = 0 then
    begin
      WriteLn ('CPU type:       ', Version.cpu, '86');
      WriteLn ('DPMI major:       ', Version.Major);
      WriteLn ('DPMI minor:       ', Version.Minor);
    end
  else
    WriteLn ('Error in DpmiGetVersion');
  if DpmiGetFreeMemoryInformation (MemInfo) = 0 then
    WriteLn ('Free DPMI memory: ',
             MemInfo.TotalNumberOfFreePages, ' pages.')
  else
    WriteLn ('Error in DpmiGetMemoryInformation');
end.
@end example

@node Stack size
@subsection I got an exception when accessing an @samp{array [1 .. 4000000] of Byte}.

Per default, the maximum stack size of a DJGPP application is 256K.
If you need more, you have to adjust it with the stubedit program,
i.e.:

@example
stubedit your_app.exe minstack=5000K
@end example

Another way is to add the following code to your program to define a
minimum stack size (here: 2 MB). This value will be honored even if
a user sets a lower value by using stubedit, so this method might be
a little safer.

Note: The syntax given here is valid for GPC releases of May 2000
and newer.

@example
@{$ifdef DJGPP@}
const
  MinStackSize: Cardinal = $200000; asmname '_stklen';
@{$endif@}
@end example

Still, it might be a good idea to use pointers for large structures,
and allocate the memory at runtime.

DJGPP has to allocate the stack in physical memory at program
startup, so one might have to be careful with too large stack
limits. Most other systems allocate stack pages on demand, so the
only reason to set a limit at all might be to prevent a runaway
recursion from eating up all memory @dots{}

On Unix-like systems, you can set a resource limit, but you don't do
it in normal programs, but rather in the shell settings (bash:
@samp{ulimit}; csh: @samp{limit}; syscall: @samp{setrlimit}(2)).

@node Strings in GPC
@section Strings

@menu
* String schema::                What's this confusion about strings?
* Strings in variant records::   Overlaying strings in variant records
* Length byte::                  Why does @samp{s[0]} not contain the length?
* Strings as value parameters::  Watch out when using strings as parameters
* Short strings::                Support for BP compatible short strings
* C strings::                    What about C strings?
@end menu

@node String schema
@subsection What's this confusion about strings?

Turbo Pascal strings have a length byte in front. Since a byte has
the range 0 .. 255, this limits a string to 255 characters. However,
the Pascal string schema, as defined in section 6.4.3.3.3 of the
ISO-10206: 1990 Extended Pascal standard, is a schema record:

@example
type
  String (Capacity: Integer) = record
    Length: 0 .. Capacity;
    String: packed array [1 .. Capacity + 1] of Char
  end;
@end example

The @samp{+ 1} is a GPC extension to make it feasible to
automatically add the @samp{#0} terminator when passing or assigning
them to CStrings. Thus at the expense of a little added complexity
(must declare capacity, don't use @samp{GetMem} without explicit
initialization of the @samp{Capacity} field, and the additional
space requirement) you can now have very long strings.

@node Strings in variant records
@subsection Overlaying strings in variant records

Q: Should the different variants in a variant record overlay in the
same memory? Previous Pascals I have used have guaranteed this, and
I've got low-level code that relies on this. The variants are not
the same length, and they are intended not to be.

A: No, this is intentional so that the discriminants are not
overwritten, and they can be properly initialized in the first
place. Consider:

@example
record
case Boolean of
  False: (s1: String (42));
  True:  (s2: String (99));
end;
@end example

If the strings would overlay, in particular their discriminants
would occupy the same place in memory. How should it be initialized?
Either way, it would be wrong for at least one of the
variants @dots{}

So, after a discussion in comp.lang.pascal.ansi-iso where this topic
came up concerning file variables (which also require some automatic
initialization and finalization), we decided to do this in GPC for
all types with automatic initialization and finalization (currently
files and schemata, in the future this might also be Delphi
compatible classes and user-defined initialized and finalized
types), since the standard does not guarantee variants to overlay,
anyway @dots{}

There are two ways in GPC to get guaranteed overlaying (both
non-standard, of course, since the standard does not assume anything
about internal representations; both BP compatible), @samp{absolute}
declarations and variable type casts. E.g., in order to overlay a
byte array @samp{b} to a variable @samp{v}:

@example
var
  b: array [1 .. SizeOf (v)] of Byte absolute v;
@end example

Or you can use type-casting:

@example
type
  t = array [1 .. SizeOf (v)] of Byte;
@end example

then @samp{t (v)} can be used as a byte array overlayed to @samp{v}.

@node Length byte
@subsection Why does @samp{s[0]} not contain the length?

Q: In standard Pascal you expect @samp{s[1]} to align with the first
character position of @samp{s} and thus one character to the left is
the length of @samp{s}. Thus @samp{s[0]} is the length of @samp{s}.
True?

A: This holds for UCSD/BP strings (which GPC does not yet implement,
but that's planned). The only strings Standard Pascal knows are
arrays of char without any length value.

GPC also supports Extended Pascal string schemata
(@pxref{String schema}), but they also don't have a length byte at
``position 0'', but rather a @samp{Length} field (which is larger
than one byte).

@node Strings as value parameters
@subsection Watch out when using strings as parameters

Q: Any ``gotchas'' with string parameters?

A: Be careful when passing string literals as parameters to routines
accepting the string as a value parameter and that internally modify
the value of the parameter. Inside the routine, the value parameter
gets a fixed capacity -- the length of the string literal that was
passed to it. Any attempt to assign a longer value will not work.

This only applies if the value parameter is declared as
@samp{String}. If it is declared as a string with a given capacity
(e.g., @samp{String (255)}), it gets this capacity within the
routine.

@node Short strings
@subsection Support for BP compatible short strings

Q: Two different kinds of strings with the same name --
@samp{String} -- does make a bit of confusion. Perhaps the oldstyle
strings could be renamed @samp{short string} ?

A: When we implement the short strings, we'll have to do such a
distinction. Our current planning goes like this:

@samp{String (@var{n})}: string schema (EP compatible)

@samp{String [@var{n}]}: short string (UCSD/BP compatible, where
@var{n} must be <= 255)

@samp{String}: dependent on flags, by default undiscriminated
schema, but in BP mode (or with a special switch) short string of
capacity 255 (UCSD/BP compatible).

Q: So when will these short strings be available?

A: It's been planned for over a year. The delay has been caused by
more pressing problems.

@node C strings
@subsection What about C strings?

A C string (@samp{char *}) is an array of char, terminated with a
@samp{#0} char.

C library functions require C, not Pascal style string arguments.
However, Pascal style strings are automatically converted to C style
strings when passed to a routine that expects C style strings. This
works only if the routine reads from the string, not if it modifies
it.

E.g., this is how you could access the @samp{system()} call in your
C library (which is not necessary anymore, since @samp{Execute} is
already built-in):

@example
program SysCall;

function System (Name: CString): Integer; asmname 'system';

var
  Result: Integer;

begin
  Result := System ('ls -l');
  WriteLn ('system() call returned: ', Result)
end.
@end example

You could use the type @samp{PChar} instead of @samp{CString}. Both
@samp{CString} and @samp{PChar} are predefined as @samp{^Char} --
though we recommend @samp{CString} because it makes it clearer that
we're talking about some kind of string rather than a single
character.

A lot of library routines in Pascal for many applications exist in
the GPC unit and some other units. Where available, they should be
preferred (e.g. @samp{Execute} rather than @samp{system()}, and then
you won't have to worry about @samp{CString}s.)

Do @strong{not} pass a C style string as a @samp{const} or
@samp{var} argument if the C prototype says @samp{const char *} or
you will probably get a segfault.

@node Getting Help
@section Getting Help

Please read the GPC Manual (info files or other formats) as well as
the @file{README} and @file{BUGS} files that come with GPC (usually
installed in directory @file{/usr/local/doc/gpc}), plus other docs
that might help (the DJGPP FAQ if you use DJGPP, etc.) before you
send email to the maintainers or mailing list.

In particular, the @file{BUGS} file contains information on how to
submit bug reports in the most efficient way.

The @samp{Support} chapter of the GPC Manual tells you where to find
more information about GPC and how to contact the GPC developers.
@ifclear FAQONLY
(@pxref{Support})
@end ifclear
@ifset FAQONLY
The following information is from this chapter.

@menu
* Mailing List::           Join the GPC Mailing List
* Mailing List Archives::  Look in the Mailing List Archives
* Newsgroups::             Ask in a newsgroup
* Professional Support::   Get individual support for GPC
* Compiler Crashes::       If the compiler crashes @dots{}
* Reporting Bugs::         I think I found a bug -- now what?
@end menu

@lowersections
@include support.texi
@raisesections
@end ifset

@node Miscellaneous FAQ
@section Miscellaneous

@menu
* Contributing::   I want to contribute; where do I start?
* GPC web site::   Where is the GNU Pascal web site?
* About the FAQ::  About this FAQ
@end menu

@node Contributing
@subsection I want to contribute; where do I start?

If you want to contribute, please write to the mailing list,
@ref{Mailing List}.

@node GPC web site
@subsection Where is the GNU Pascal web site?

The GPC homepage on the web, for information and downloads, is@*
@uref{http://www.gnu-pascal.de}.

The GPC To-Do list, listing the latest features and fixed bugs
can also be found there.

@node About the FAQ
@subsection About this FAQ

Current Maintainer: Russ Whitaker @email{russ@@ashlandhome.net}

This is the second incarnation of the GNU Pascal FAQ list, based on
the previous FAQ by J.J. van der Heijden. Comments about,
suggestions for, or corrections to this FAQ list are welcome.

Please make sure to include in your mail the version number of the
document to which your comments apply (you can find the version at
the beginning of this FAQ list).

Many people have contributed to this FAQ, only some of them are
acknowledged above. Much of the info in, and inspiration for this
FAQ list was taken from the GPC mailing list traffic, so you may
have (unbeknownst to you) contributed to this list.
