This is How I understand the var parameter.
It is an address, but is treated as normal variable, so it is not needed
to dereference a pointer.
For example
int f(int* x) in C/C++ corresponds to
function f(var x: integer): integer;
Now we have
int f(int x);
If you declare it as
function f(var x: integer): integer;
and then try to assign something to x, the access violation is very
probably raised because x contains value, not address.
Dňa 19. 4. 2013 21:15 Leonardo M. Ramé wrote / napísal(a):
On 2013-04-19 21:08:29 +0200, Lubos Pintes wrote:
I probably don't understand. You will be able to change it, I see no
problem. It is a local variable which can be changed.
Dňa 19. 4. 2013 20:55 Leonardo M. Ramé wrote / napísal(a):
On 2013-04-19 20:52:04 +0200, Lubos Pintes wrote:
I think you could not declare the second parameter of GetData as var
parameter. Because it is then treated as address.
I am not sure what corresponds to C++ unsigned long, perhaps LongWord?
So try to change the second parameter so that it is not a var parameter.
Dňa 19. 4. 2013 19:18 Leonardo M. Ramé wrote / napísal(a):
But I need the 2nd param to be changed by the function, that's why I
declare it as var.
Well, removing the "var" in the 2nd param, at least allowed avoid the
SIGSEGV. I don't know why, though.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus