[fpc-pascal] Pointer to a const char
Michael Schnell
mschnell at lumino.de
Tue Nov 5 09:06:45 CET 2013
On 11/04/2013 02:18 PM, Alexander wrote:
> How can I describe a "pointer to a constant char" in FreePascal?
>
> For example this C function:
>
> int some_func(const char *arg, ...);
>
>
> 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".
In fact in c const "char *arg" does not mean a constant pointer to a
character, but a pointer to a constant character,
As in C you need to pass explicit pointers and in Pascal you can do this
implicitly by using var or const, I suppose
function some_fuc(const arg: char): cint; cdecl; external;
should do this.
-Michael
More information about the fpc-pascal
mailing list