News:

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

Help Generating an Executable w/out visual

Started by victorvmpm, April 27, 2010, 09:51:51 PM

Previous topic - Next topic

victorvmpm

Please, that sounds great! it would really help me!

Thanks everyone and thanks in advance joemc!

joemc

here is a short sample of how you would run ml.exe and link.exe
it does not do all the features mentioned earlier. i cannot find source. may rewrite it, but i cannot find it.  Would not be hard to write from here, just need a few FindFirstFile and a little logic.


include \masm32\include\masm32rt.inc

.data?
value dd ?

.data
item db "Test",13,10,0
szMLEXE db "C:\masm32\bin\ml.exe",0
szMLCMD db "/coff /Fo .\obj\jmake.obj /c jmake.asm",0
szLINKEXE db "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exe",0
szLINKCMD db "/subsystem:CONSOLE -LIBPATH:c:\masm32\lib .\obj\jmake.obj",0
sinf STARTUPINFO <>
pinf PROCESS_INFORMATION <>

.code

start:
cls


invoke GetStartupInfo, OFFSET sinf
invoke CreateProcess,OFFSET szMLEXE,OFFSET szMLCMD,NULL,NULL,FALSE, NORMAL_PRIORITY_CLASS,NULL,NULL,OFFSET sinf,OFFSET pinf
invoke CloseHandle,pinf.hThread

invoke WaitForSingleObject, pinf.hProcess, INFINITE

invoke CloseHandle,pinf.hProcess

invoke CreateProcess,OFFSET szLINKEXE,OFFSET szLINKCMD,NULL,NULL,FALSE, NORMAL_PRIORITY_CLASS,NULL,NULL,OFFSET sinf,OFFSET pinf
invoke CloseHandle,pinf.hThread

invoke WaitForSingleObject, pinf.hProcess, INFINITE

invoke CloseHandle,pinf.hProcess


inkey
exit
end start


edit:

just tested it and for some reason it is not accepting the /subsystem flag... idk why yet... it still assembles and links though.  just gives  a warning saying defaulting to console. Not sure how i did it before. i may disassemble it and find out what i did last time.   ML also has a linker built in if you would rather just call it. The only reason you would not want to use it is if your compiler wanted to output object files.

joemc


hutch--

If you are going to do this stuff, write the build info as a batch file then run the batch file and you don't have any inheritance or process ownership problems.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php