Re: Problem Linking (win32)



bwaichu@xxxxxxxxx wrote:

....
A consistent error occurs upon the loading of my asm. No error occurs
at loading if I leave out functions that link back to msvcrt.dll. I'm
not sure if this is a linking problem or a loading problem or
something else.
I do know that I do not have this problem when building with alink
and
OMF files.

Here's another example. This example results in this error being set
upon loading:

ERROR_ENVVAR_NOT_FOUND (000000CB)

Google leads me to:

http://msdn.microsoft.com/en-us/library/ms683188(VS.85).aspx

Apparently, that would be the expected result of a failed GetEnvironmentVariable call. We didn't call GetEnvironmentVariable - not on purpose, anyway. Did the loader call it? Is this a "misleading" value, that means something else in this context? How long ago might "last error" have happened? Nasm would be looking for "NASMENV", and probably not finding it. The linker would probably be checking environment variables, too. I wouldn't "expect" GetLastError to persist from one program to another, but...

And this happens every time.

.... just to rule it out, does "every time" include rerunning the program without any assembling/linking in between?

Check out the value of eax after
GetLastError is called.

Right...

This could just be an issue with MS's loader
on xp.

;nasm -f win32 atext.asm
;golink /console atext.obj kernel32.dll user32.dll msvcrt.dll

extern printf
extern ExitProcess
extern GetLastError

section .text text CLASS=TEXT

global start
start:

call [GetLastError]

We could:

push eax

push dword sText

Use a format string with "%X" in it...

call printf
add esp, 4

And adjust to "add esp, 4 * 2"...

push dword 0
call [ExitProcess]

section .data data CLASS=DATA

sText dd "Test", 0

Any ideas? Can you reproduce my error on your machines?

I'm just "stubborn" about Windows. When the last time to "reinstall system" came around, I said "No, Enough!". I could easily access a machine running Windows, but I'm trying to help MicroSoft avoid becoming a "monopoly"... Sorry...

Best,
Frank

.