Recent

Author Topic: Problems with creating a parameter of Int** name found in C code  (Read 355 times)

jamie

  • Hero Member
  • *****
  • Posts: 7902
Trying to create a parameter of Pointer to a Pointer as a Parameter.

Code: Pascal  [Select][+][-]
  1.  
  2. Function Name( Var Item:PInteger); //?
  3.  


And in code Land.


Name(@IntegerVariable);

Compiler does not allow that?

How to simulate a   Pointer to  pointer of Integer as a parameter ?

Jamie
The only true wisdom is knowing you know nothing

Thaddy

  • Hero Member
  • *****
  • Posts: 19625
  • Glad to be alive.
Re: Problems with creating a parameter of Int** name found in C code
« Reply #1 on: July 09, 2026, 04:20:09 pm »
Code: Pascal  [Select][+][-]
  1. type
  2.   PPInteger = ^PInteger;
Maybe it is already declared in the types unit. Freepascal also uses that type in some libraries.
Any "programmer" that knows only one programming language is not a programmer

jamie

  • Hero Member
  • *****
  • Posts: 7902
Re: Problems with creating a parameter of Int** name found in C code
« Reply #2 on: July 09, 2026, 04:28:57 pm »
Ok, I'll try that later, I need to step out and have them Reset my heart today, its running like a broken Ford! :o

CUL
Jamie

The only true wisdom is knowing you know nothing

Thaddy

  • Hero Member
  • *****
  • Posts: 19625
  • Glad to be alive.
Re: Problems with creating a parameter of Int** name found in C code
« Reply #3 on: July 09, 2026, 04:30:53 pm »
Take care, Jamie!
Any "programmer" that knows only one programming language is not a programmer

H₂SO₄

  • Sr. Member
  • ****
  • Posts: 485
Re: Problems with creating a parameter of Int** name found in C code
« Reply #4 on: July 10, 2026, 06:25:23 am »
Trying to create a parameter of Pointer to a Pointer as a Parameter.

Code: Pascal  [Select][+][-]
  1. Function Name( Var Item:PInteger); //?
  2.  


Name(@IntegerVariable);

var  parameters require an lvalue (a variable, roughly speaking), so you can't just take the address at the call site - you'll have to store it somewhere:

Code: Pascal  [Select][+][-]
  1. var
  2.   Item: Integer;
  3.   ItemPtr: PInteger;
  4.  
  5. ItemPtr := @Item;
  6. Name(ItemPtr);

Ok, I'll try that later, I need to step out and have them Reset my heart today, its running like a broken Ford! :o

Hang in there!
« Last Edit: July 10, 2026, 06:52:36 am by Khrys »

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1604
    • Lebeau Software
Re: Problems with creating a parameter of Int** name found in C code
« Reply #5 on: July 10, 2026, 06:28:22 am »
Code: Pascal  [Select][+][-]
  1. Function Name( Var Item:PInteger); //?


And in code Land.

Code: Pascal  [Select][+][-]
  1. Name(@IntegerVariable);

Compiler does not allow that?

"var PInteger" will work, you just need a variable to satisfy the var reference:

Code: Pascal  [Select][+][-]
  1. var p: PInteger;
  2. p := @IntegerVariable;
  3. Name(p);
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

jamie

  • Hero Member
  • *****
  • Posts: 7902
Re: Problems with creating a parameter of Int** name found in C code
« Reply #6 on: July 11, 2026, 12:10:44 am »
Ok, I settled for the PPinteger, that seems to work the closes to match the C code.

Thank You.

Jamie
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018