I am writing a kind of command interpreter and I need to run a procedure / function on a line containing its name.

I’ve seen this method, but it doesn’t work in Linux - it just doesn’t compile ( WinApi doesn’t find the GetModulehandle , getprocAddress and HWND types).

What to do?

  • >> "the objects property will store the addresses of the necessary procedures." - That's the whole problem - I don't know how to get the address of the procedure in linux - maybe you need to plug in a module? - softforwinxp
  • no need to connect anything. the address is obtained simply - via @ or addr() . - KoVadim
  • Thanks, I will try. Is it possible to use records for these purposes or is it better not? - softforwinxp
  • you can write, but most likely you will need to store an array of pairs of "name" - "address". And StringList can do it. Moreover, if the elements are sorted, the search in the list will be with logarithmic complexity. True, if you have 10-15 functions, then there is little point in this. - KoVadim

1 answer 1

If you need a universal way, then you need to make yourself some TStringList with a list of all the necessary functions and procedures and the objects property will store the addresses of the necessary procedures. Or to write the successor from TList, then it will be possible to make even check of arguments easily.