The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: shankle on December 25, 2007, 04:48:55 AM

Title: winmaincrtstartup
Post by: shankle on December 25, 2007, 04:48:55 AM
Went to a program of several years ago to make a small change and
the "winmaincrtstartup" reared its ugly head. The program is written in
Masm32. The code to link follows and works on many other programs.
The posts here on this topic do not really answer the question.

if exist %1.obj del %1.obj
if exist %1.exe del %1.exe
\masm32\bin\ml /c /coff %1.asm
if not exist %1.obj goto END
echo %1.obj created
\MASM32\BIN\Link /SUBSYSTEM:WINDOWS %1.obj
if not exist %1.exe goto END3
echo %1.exe created
echo GOOD COMPILE & LINK
goto TheEnd 
:END3
echo %1.exe file not created
goto TheEnd
:END
echo %1.obj file not created
:TheEnd

Thanks for any help,
JPS
Title: Re: winmaincrtstartup
Post by: MichaelW on December 25, 2007, 06:19:27 AM
I don't know exactly what problem you are having, but I have noticed that I can trigger a:

LINK : error LNK2001: unresolved external symbol _mainCRTStartup

By not specifying a start address on the END directive.
Title: Re: winmaincrtstartup
Post by: ToutEnMasm on December 25, 2007, 09:51:26 AM
Hello,
This mean that the source code is writen with a standard C entry point and not a standard masm entry point.
masm entry point:
Quote
.code
start:
end start
c entry point:
Quote
.code
anyproc proc
anyproc endp
WinMain proc STDCALL public uses esi edi ebx, hInst:DWORD,hPrev:DWORD,\
                        lpCmdLine:DWORD,nShowCmd:SDWORD
WinMain endp
end
Title: Re: winmaincrtstartup
Post by: shankle on December 25, 2007, 12:50:10 PM
Thanks guys.
Problem fixed.
I wrote the program on Windows 98 2nd ed.
Maybe that's why I got away with the error
and XP won't.
JPS
Title: Re: winmaincrtstartup
Post by: shankle on December 25, 2007, 02:04:43 PM
Correction. My last statement is incorrect.
The problem is fixed but the cause is not Windows 98.
This is a good example of why good notes are so important.

Program A includes a module BB. BB can not have a "Start or END START"
statement in it. BB can not be compiled but must be put in the include
lib with a makelib.bat.