PRB: putchar Fails in C Code Called from FORTRAN Application (118396)
The information in this article applies to:
- Microsoft Fortran Powerstation 32 for Windows NT 1.0
- Microsoft Fortran Powerstation 32 for Windows NT 4.0
This article was previously published under Q118396 SYMPTOMS
In a mixed-language program, compiling the FORTRAN code using the /MD
option prevents the C Run Time function "putchar" from operating.
For Fortran PowerStation 4.0, the following warning message is generated:
LINK: warning LNK4098: defaultlib "LIBC" conflicts with use of other
libs; use /NODEFAULTLIB:library
CAUSE
This behavior is by design. You cannot safely mix objects built for
different program execution models. In this case, putchar('c') is a macro
that expands to putc(c,stdout) and stdout is defined differently in
MSVCRT.LIB than it is in the statically linked libraries.
RESOLUTION
To work around this problem, either
- Use the /MD option on the C code as well.
-or-
- Compile the Fortran code using /MT instead of using /MD.
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | kbCompiler KB118396 |
---|
|