Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

Procedure type in procedure parameters

A community discussion post from the original code:zIRON forum.

0CodErr member
Posts
201
Threads
37
Location
Unknown

Procedure type in procedure parameters

We can do able to write like this:

procedure Proc1(procedure* SomeProc; function* SomeFunc){
  SomeProc();
  eax = SomeFunc();
}

procedure Proc2(){}
function Func1(){return true;}

Proc1(Proc2, Func1);

Maybe need define parameters like

procedure* SomeProc(dword p1, p2)

Also should pay attention on different calling conventions.

It would be useable i think :)

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

This is a good idea, I will add it to my list, but with lower priority for now until other items on my list are completed.

0CodErr member
Posts
201
Threads
37
Location
Unknown

It a bit relevant to this topic:

program RAW_IMAGE 'test';

#set bits 32;

procedure TestA(pointer P) {
  procedure* MyProc(dword x, y, z); MyProc = P;
  MyProc(1, 2, 3);
}
procedure TestB(pointer P) {
  procedure* MyProc(dword x, y, z); MyProc = P;
  MyProc(1, 2, 3);
}
TestA(0); TestB(0);
Instruction usage is not supported!
Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have fixed this for next release, however, I will try to get around to declaring methods for local vars as soon as possible. (maybe using AS will be a good idea for now)

0CodErr member
Posts
201
Threads
37
Location
Unknown
procedure TestA(pointer P) {
  procedure* MyProc(dword x, y, z); MyProc = P;
  MyProc(1, 2, 3);
}
Unexpected symbol ;
0CodErr member
Posts
201
Threads
37
Location
Unknown

... if we change in code above 'procedure' with 'function'

0CodErr member
Posts
201
Threads
37
Location
Unknown

Cannot compile even if we write

[@MyProc] = P
Colin admin
Posts
928
Threads
49
Location
Bulgaria
Unexpected symbol ;

Functions must have a return type declared.

  function* MyProc(dword x, y, z): DWord; MyProc = P;