Hello
Ripened such a question, pondered for a long time, sort of articulated. As in any language, to output a variable to any other language, i.e. so that any other application can handle it?
Approximately implementation I represent such:
- We take the address of the variable
- We take the length in bytes
- Pass them on to the process.
- We are waiting for changes
- We continue work
The tags indicate the languages that I will be able to check myself in the near future, as well as any. Axis - Windows (if you are interested in lin, create plz a separate topic, because I can not check)
The condition is not to use pipes, sockets, etc. (unless to transfer the address and length). Why - well, for example, because transferring a 200-meter array through a local socket may take longer than processing it in an assembler. There is likely to be adequate to write to the file of two long int, because This is the easiest and most stable for any language - write and retrieve from a file. Accordingly, consider that the application may not have access to this memory area and provide it.
Stock for delphi (not aware of whether the variable will be available):
var myVar: String; varLink: Cardinal; varLength: Cardinal; ... myVar := '0lol'; // myVar[1] - статус varLink := Cardinal(Addr(myVar)); varLength := Cardinal(Length(myVar)); makeCommonVar(varLink, varLength); // собственно, оно while myVar[1] = '0' do // пока в статусе ноль, отдыхаем begin Sleep(50); Application.ProcessMessages; end; ShowMessage(myVar); // показываем переменную
Perhaps muddled ... Something like "let's write bridges between all languages." You can recall the well-known ArtMoney majority - the principle of work is somewhere nearby.
Yes, php is there in the labels separately - I do not even know if it is possible (and how) to get the address (int) of a variable.
If the code does not threaten to be huge - examples are welcome. Why is this all? Well, for example, different languages have different tasks and somewhere the processing of a variable can be faster / more convenient / easier, after all.