Le 04/11/2013 14:18, Alexander a écrit :
How can I describe a "pointer to a constant char" in FreePascal?

For example this C function:

int some_func(const char *arg, ...);
... coulb be translated to
some_proc(const arg: PChar, ...);

where the argument cannot be changed in any way (the compiler complains) but the data to which the argument points can be freely changed, thus:
(arg + offset)^ := #0;		works
I don't know a way to make the data pointed to, as being constant.
Have a look at http://www.freepascal.org/docs-html/ref/refsu61.html#x160-17000014.4.4

Antonio.



My guess in FreePascal is this(with ctypes unit):

function some_func(const arg: pcchar): cint; cdecl; external;

A constant argument to a function.
I'm not sure, is it a "constant pointer to a char", or a "pointer to a constant char".
The first one applies.

--
Alex


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

--
Sita
                Software
Antonio Fortuny
Senior Software engineer

220, avenue de la Liberté
L-4602 Niederkorn
Tel.: +352 58 00 93 - 93
www.sitasoftware.lu
Your IT Partner
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to