News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

StdOut not give output to console

Started by Yola, July 28, 2011, 06:53:09 PM

Previous topic - Next topic

Yola

Following code not working properly:
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess, 0
end start

It doesn't give any output to console from where called. But if i try windows version with MessageBox then message window appears. Whats wrong?

Vortex

Hi Yola,

Did you build your project as a console application?

\masm32\bin\ml /c /coff Test.asm
\masm32\bin\link /SUBSYSTEM:CONSOLE Test.obj


/SUBSYSTEM:CONSOLE instead of /SUBSYSTEM:WINDOWS

dedndave

it works, here   :U
C:\Masm32\Asm>stdout
Hello World!
C:\Masm32\Asm>

dedndave

here's an even lower level version   :P
        INCLUDE \masm32\include\masm32rt.inc

        .DATA

Hello   db 'Hello World!'

        .DATA?

ByteCnt dd ?

        .CODE

_main   PROC

        INVOKE  GetStdHandle,STD_OUTPUT_HANDLE
        INVOKE  WriteFile,eax,offset Hello,sizeof Hello,offset ByteCnt,NULL
        INVOKE  ExitProcess,0

_main   ENDP

        END     _main

Yola

Quote from: Vortex on July 28, 2011, 06:54:34 PM
Hi Yola,

Did you build your project as a console application?

\masm32\bin\ml /c /coff Test.asm
\masm32\bin\link /SUBSYSTEM:CONSOLE Test.obj


/SUBSYSTEM:CONSOLE instead of /SUBSYSTEM:WINDOWS
Thanks you man!