Author Topic: Calling TextOut  (Read 9200 times)

mark allyn

  • Guest
Calling TextOut
« on: September 05, 2009, 05:36:17 PM »
Hello everyone-

I cannot manage to successfully call the windows gdi function "TextOut" in a simple windproc.  The proc works fine with DrawTextA.  But, I keep getting message that there is an undefined reference to TextOutA@20 when I try to do the same output rather than DrawTextA.  I am using NASMX inc/win32 includes in the file, including all includes that reference TextOut.   I have tried decorating the call with an underscore, with and without the @20 postfix.  I have tried using an extern statement (even though I'm including the gdi include) with TextOut and in various combinations of _ decoration and A@20 postfix.  Man, I am baffled!

Thanks for looking at this problem.

Mark Allyn

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Calling TextOut
« Reply #1 on: September 09, 2009, 12:02:07 AM »
Looks like you've got everybody stumped on this one, Mark! Grepping through the old NASM32 include files, I see it referred to as "_TextOutA" and "_TextOutW", apparently. The damn NASMX package is an executable (the Windows version - I've got the Linux version, but it doesn't have "TextOut", of course). Possible it was left out through a "bug"? Can you grep for it?

A very quick test using "-f obj" and "import" (from gdi32.dll) "seems to work" - I don't think it'll actually run. That doesn't help you. If you want to zip up the results of running the NASMX executable and send 'em to me - fbkotler at myfairpoint dot net - I can look. Probably won't see anything... "Should Work", I think...

Best,
Frank

nobody

  • Guest
Re: Calling TextOut
« Reply #2 on: September 09, 2009, 12:25:02 AM »
You probably need to add...

%include '..\..\..\inc\win32\gdi32.inc'

...just below the rest of the includes...

%include '..\..\..\inc\nasmx.inc'
%include '..\..\..\inc\win32\windows.inc'
%include '..\..\..\inc\win32\kernel32.inc'
%include '..\..\..\inc\win32\user32.inc'

mark allyn

  • Guest
Re: Calling TextOut
« Reply #3 on: September 09, 2009, 02:09:16 PM »
Hi Frank & Nobody.

I forgot to mention that I did include gdi32.inc.  Still doesn't run--same message that I am trying to use an undefined reference to TextOut.  A piece of additional info:  If I postfix A to TextOut (TextOutA) I get a message that says that this is an undefined reference to TextOutA@20.  If I don't postfix A, the message says that it is an undefined reference to TextOut.  It is intriguing that NASM adds in the @20...somehow it does seem to recognize a part of the symbol.

Frank--I grepped thru my copy of NASMX and it looks to me like the necessary defs are there in the includes.  They look like identical versions of what's in the "same" files for MASM32.  So, somehow it looks like the executable is just flat missing.  

Dunno if I mentioned but a call to DrawTextA works just fine for me.  Maybe Keith Kanios can shed some light on this?

Regards to all,

Mark