Name Coordination

Name Coordination

Coordination of calls, as you have seen, has been removed from the agenda. Name coordination, on the contrary, became more complicated with time. Some of the aspects of this problem are already known to you. The MASM translator adds the @N suffix to names ; N is the number of parameters passed to the stack. The Visual C++ compiler does the same thing. Thus, problems arise when it becomes necessary to coordinate two modules written in Assembly language. TASM is a more flexible compiler in this respect, because the @N suffix can be added to any name as needed.

Another problem is the leading underscore character. MASM generates the underscore automatically if the standard call ( STDCALL ) calling convention is specified in the beginning of the program. TASM doesn't do this; consequently, if necessary, this should be done manually, which in my opinion is an advantage. An interesting point is that Borland and Microsoft take different positions in this respect.

Another problem is the coordination of uppercase and lowercase letters . Recall that when assembling a program using TASM, the /ml command-line option is used to distinguish uppercase and lowercase letters. MASM, on the other hand, does this automatically. As you know, the standard for the C programming language initially assumed a difference between uppercase and lowercase characters . Pascal, on the other hand, is not case-sensitive. There is certain logic, because Turbo Pascal and Delphi do not create standard object modules but can link them. When creating dynamic link libraries (DLLs), the names are placed there as they were specified in procedure headers.

Finally, there is the last problem related to the coordination of namesC++ qualifiers. C++ allows so-called overloading. This means that the same name can relate to different functions. In a program, these functions differ in the number of parameters, their types, and the type of the return value. Therefore, the C++ compiler automatically complements the names so that different functions are distinguished when linking. Naturally, Borland and Microsoft add different suffixes to the function names. As usual, they never care to coordinate their positions. However, this problem isn't difficult to overcome . It is only necessary to use the EXTERN modifier for the names expected to be accessed from other C modules. This technique is illustrated in the examples provided later in this chapter.



The Assembly Programming Master Book
The Assembly Programming Master Book
ISBN: 8170088178
EAN: 2147483647
Year: 2004
Pages: 140
Authors: Vlad Pirogov

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net