<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">Le 04/11/2013 14:18, Alexander a
écrit :<br>
</div>
<blockquote
cite="mid:CAJmUBggwLEnTXKsLDAJo6JfLhd7ZRvy9MUq0D1nBRTEvWM8YJQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<pre style="color:rgb(17,17,17)">How can I describe a "pointer to a constant char" in FreePascal?
For example this C function:
int some_func(const char *arg, ...);</pre>
</div>
</blockquote>
... coulb be translated to<br>
<pre style="color:rgb(17,17,17)">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 <a href="http://www.freepascal.org/docs-html/ref/refsu61.html#x160-17000014.4.4">http://www.freepascal.org/docs-html/ref/refsu61.html#x160-17000014.4.4</a>
Antonio.
</pre>
<br>
<blockquote
cite="mid:CAJmUBggwLEnTXKsLDAJo6JfLhd7ZRvy9MUq0D1nBRTEvWM8YJQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<pre style="color:rgb(17,17,17)">
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".</pre>
</div>
</blockquote>
The first one applies.<br>
<blockquote
cite="mid:CAJmUBggwLEnTXKsLDAJo6JfLhd7ZRvy9MUq0D1nBRTEvWM8YJQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
-- <br>
Alex
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<table
style="font-family:'Calibri','sans-serif';font-size:8.0pt;color:#002f87;border:0;width:auto;">
<tbody>
<tr>
<td style="vertical-align:bottom;padding:40px 20px
25px;border-top:1pt solid #BFBFBF;"> <img alt="Sita
Software"
src="cid:part2.05000004.07040507@sitasoftware.lu"> </td>
</tr>
<tr>
<td style="vertical-align: top; padding: 5px 20px 0;"> <b>Antonio
Fortuny</b><br>
Senior Software engineer<br>
<br>
220, avenue de la Liberté<br>
L-4602 Niederkorn<br>
Tel.: +352 58 00 93 - 93<br>
<a style="color:#002f87;cursor:pointer;text-decoration:
none;" href="http://www.sitasoftware.lu">www.sitasoftware.lu</a><br>
</td>
</tr>
<tr>
<td style="padding:20px 20px 30px;border-bottom: 1pt solid
#BFBFBF;" align="right"> <img alt="Your IT Partner"
src="cid:part4.07020205.02080006@sitasoftware.lu"> </td>
</tr>
</tbody>
</table>
</div>
</body>
</html>