There's also %CURRENTROUTINE%, […]
First I thought of that, too, but
{$include %currentRoutine%} does apparently not contain any unit or namespace information, it’s really just the routine’s name.
is it possible to call this Function from different Unit's and then check wich unit called the Function ?
No, it’s not possible. There’s no means to determine the caller’s origin, the unit.
Units merely modularize your code, yet it essentially doesn’t make a difference—with respect to the generated machine code—whether you put everything in one file or in separate files. This information is lost during compilation.
[…]
//can i check somehow wich Unit called ?
UnitXY.MyRecord.values := changed
End;
I see you apparently want to access an identifier that’s been declared in another unit, right? So, passing a string as parameter, as GetMem suggested, wouldn’t be of much help.
You will need to pass
MyRecord as a
var paremeter in order to modify it from another unit. Then you don’t need to specify an FQI (precede the identifier with the unit’s name).
Or do OOP, objected-oriented programming.