Hi!
I am a new user of MASM32. I did try the following program:
; #####################################################

.386
.model flat, stdcall
option casemap :none ; case sensitive

; #####################################################

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc

include \masm32\include\masm32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib

; #####################################################
.data
prompt db 'Hello World',0dh,0ah,0
.code
start:
invoke StdOut,ADDR prompt
invoke ExitProcess,0
end start

Why the message 'Hello World' did not show up on the current console? I don't want to create a new console (call AllocConsole).
N.B. There was a linker message, "LINK:warning LNK4089: all references to "user32.dll" discarded by /OPT:REF". What does it mean?

Iew.
Posted on 2003-07-08 20:35:58 by iew
I compiled it and had the same problem, I changed the PE Subsystem to 3 (console)
and it worked fine. I am not a masm guy, so guys :) how do you specify console instead of gui
in masm?

RobotBob
Posted on 2003-07-08 21:23:51 by RobotBob
invoke StdOut,ADDR prompt
invoke ExitProcess,0

Why the message 'Hello World' did not show up on the current console?

The message did show up. You were just not fast enough to see it because you closed the console window as soon as the message was displayed!:(

Simply insert code to poll the keyboard before the "invoke ExitProcess" and you can admire the message until you press a key.:grin:
N.B. There was a linker message, "LINK:warning LNK4089: all references to "user32.dll" discarded by /OPT:REF". What does it mean?
This only means that you didn't use any of the functions in "user32.dll" and you could remove from your program all "includes" related to that dll.

Raymond
Posted on 2003-07-08 23:02:38 by Raymond
The message did show up. You were just not fast enough to see it because you closed the console window as soon as the message was displayed!


I disagree. I ran his app from a cmd window.
But when it changed the subsystem in the PE header it work fine.

Its more of a console app - gui app set in pe header thing.

I could be wrong.

I guess you need to link it with:
/SUBSYSTEM:CONSOLE

EDIT: man I added the link thing as donkey did lol


RobotBob
Posted on 2003-07-08 23:21:18 by RobotBob
Or you can allocate the console and set up the handles yourself, though that would be pretty senseless. ;)
Posted on 2003-07-09 00:44:55 by iblis
Thanks, every body especially Donkey. It's work now.
Iew
Posted on 2003-07-09 00:53:24 by iew
The editor in MASM32 is aready set up with the option to build console applications and the batch files that those options drive has the correct subsystem option.

If you are going to use the library functions for text input or output to the console, build the app as a console app and everything will display properly as long as you wrote the code so it works OK.

Regards,

hutch
Posted on 2003-07-09 02:25:04 by hutch--