Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roles of Delphi function name in Obj files

what is the roles of function name that's Delphi does when compiling pas file.

for example the following code

unit Hellopas;
interface
function HelloFromPas():Integer; stdcall; 

will preduce this function name @Hellopas@HelloFromPas$qqsv

so what is the Delphi roles for that?

like image 907
Emil_halim Avatar asked Dec 03 '25 09:12

Emil_halim


1 Answers

This is a decorated or mangled name. The name encodes the full scope for the function, and its parameters. The unit name is included because that is part of the fully qualified name. The parameters, return value and calling convention are encoded also, here as qqsv.

Wikipedia explains the need for mangling like this:

In compiler construction, name mangling (also called name decoration) is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages.

It provides a way of encoding additional information in the name of a function, structure, class or another datatype in order to pass more semantic information from the compilers to linkers.

The need arises where the language allows different entities to be named with the same identifier as long as they occupy a different namespace (where a namespace is typically defined by a module, class, or explicit namespace directive) or have different signatures (such as function overloading).

Any object code produced by compilers is usually linked with other pieces of object code (produced by the same or another compiler) by a type of program called a linker. The linker needs a great deal of information on each program entity. For example, to correctly link a function it needs its name, the number of arguments and their types, and so on.

like image 84
David Heffernan Avatar answered Dec 05 '25 00:12

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!