INFO: Sharing Common C Types with MASM (104616)
The information in this article applies to:
- Microsoft C for MS-DOS
- Microsoft C for OS/2
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q104616 SUMMARY
The sample code below demonstrates how to share variables of type
char, short, and long between a Microsoft C program and a Microsoft
Macro Assembler (MASM) program. This is accomplished by declaring the
C variables outside the a function definition, which makes them
public. The MASM subprogram can gain access to these public variables
by declaring them with the EXTRN directive. The EXTRN directive has
the following format
EXTRN <name>:<type>
where <name> represents the public name of the variable as it is
declared in the main module, and <type> can be either BYTE, WORD,
DWORD, FWORD, QWORD, or TBYTE. Note that in MASM 6.0 and later, EXTRN
is a synonym for EXTERN. If you are using MASM 6.x, then you should
use EXTERNDEF, because it is more flexible when used in different
contexts.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbcode kbCompiler kbinfo KB104616 |
---|
|