[fpc-pascal] Pointer to a const char
Antonio Fortuny
a.fortuny at sitasoftware.lu
Tue Nov 5 09:07:14 CET 2013
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 athttp://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 at 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 <http://www.sitasoftware.lu>
Your IT Partner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131105/0036bd0e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ajdiagjh.jpg
Type: image/jpeg
Size: 2306 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131105/0036bd0e/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ieaaijga.jpg
Type: image/jpeg
Size: 921 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131105/0036bd0e/attachment-0001.jpg>
More information about the fpc-pascal
mailing list