Slide 14.4: Inline assembly code (cont.) Slide 14.6: Linking to C/C++ (Cont.) Home |
.MODEL
directive and create a prototype for each procedure called from an external C/C++ program.
For example,
.586 .model flat, C Encript PROTO, buf:PTR BYTE, count:DWORD, eChar:BYTEDeclaring the Function
extern
qualifier when declaring an external assembly language procedure.
For example, this is how to declare Encript
:
extern void Encript( char* buf, long count, char eChar );
If the procedure will be called from a C++ program, add a ‘C’ qualifier to prevent C++ name decoration:
extern "C" void Encript( char* buf, long count, char eChar );
Name decoration is a standard C++ compiler technique that involves modifying a function with extra characters that indicate the exact type of each function parameter.