News:

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

A good question on CRT startup library

Started by ToutEnMasm, February 14, 2008, 02:25:40 PM

Previous topic - Next topic

ToutEnMasm

Hello,
How can be write in masm the same thing that the crt library do ?
That is:

masm source:

Quote
;.....
includelib MasmStartup.lib
.code
     StartupMasm Proc
     StartupMasm endp
     ..other proc
end

The thing I don't know how to write,that made the MasmStartup.lib

Quote
       Some Idea for that ?




drizz

It's as simple as declaring StartupMasm in MasmStartup.lib as extern,
and put entrypoint in MasmStartup.lib
The truth cannot be learned ... it can only be recognized.

ToutEnMasm


ToutEnMasm


But.....
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup

How to avoid this,I have no use of libcmt.lib,at this time

drizz

Yes, you can't call entrypoint "start:", you have to specify two labels mainCRTStartup & WinMainCRTStartup

.686
.model flat,stdcall
option casemap:none
option proc:private
include kernel32.inc
includelib kernel32.lib

EXTERN STDCALL StartupMasm:PROTO STDCALL

.code

mainCRTStartup proc c public
;SUBSYSTEM:CONSOLE
invoke StartupMasm
invoke ExitProcess,eax
mainCRTStartup endp

WinMainCRTStartup proc c public
;SUBSYSTEM:WINDOWS
invoke StartupMasm
invoke ExitProcess,eax
WinMainCRTStartup endp

end


HtH
The truth cannot be learned ... it can only be recognized.

ToutEnMasm