Mixed C and MASM with MASM Main Language, C Run-Time (86816)
The information in this article applies to:
- Microsoft Macro Assembler (MASM) 5.0
- Microsoft Macro Assembler (MASM) 5.1
- Microsoft Macro Assembler (MASM) 5.1a
- Microsoft Macro Assembler (MASM) 6.0
- Microsoft Macro Assembler (MASM) 6.0a
- Microsoft Macro Assembler (MASM) 6.0b
This article was previously published under Q86816 SUMMARY
The following steps should be considered when doing mixed-language
programming between the Microsoft Macro Assembler (MASM) and Microsoft
C with MASM as the main language, but the C startup code is to be
brought in to enable the assembly module to call a C run-time routine:
- Include the statement
in the assembly module to ensure that C naming and calling
conventions are used and that the modules use the same default
segments. The <model> will be small, medium, compact, or large.
- Use the END directive in the assembly module, but do not specify
the entry point.
- The start of the assembly module should be labeled
and the label should be made public with the following statement:
- Include the following statement to force a load of the C startup
code:
- Assemble the assembly module with /Mx to preserve the case of
nonlocal names. If using MASM version 6.0 or later, use /Cx to
preserve the case of nonlocal names.
Note that the stack declaration comes from the C startup code. The
entry point is in the C startup code, so no entry point should be
specified in the assembler module with the END directive. Doing so
will cause only a part of the necessary initialization to be performed
(that is, a stack will be created, but SS will not get its segment
value).
Modification Type: | Minor | Last Reviewed: | 10/29/2003 |
---|
Keywords: | KB86816 |
---|
|