Hi !
I've made an ASM file, compiled it to .obj with FASM, until that everything's ok, but when i try to make an exe from the obj file with polink, i get : "Unresolved external symbol "__mainCRTStartup"
Do you know how i could resolve that ?
The main is : _WinMain@16: and is declared as public
thanks !
Hello,
The default entry point depends on the selected subsystem (windows, console...) but is (of course) targeted at Pelles C.
You can can use the option /entry:symbol to change the entry point. In your case, something like /entry:_WinMain@16...
Pelle
Thanks for the reply !
It's a windows program, do i have to add something to the asm code to don't have to put /entry:... each time i compile ?
Anyway i can do that since it's working !!
Thanks again !!
In fact i've found a problem with using this method: It opens a console, but it's not a console app, what can i do to don't show this console ?
Thanks !!
GTN
Quote from: "GTN"Thanks for the reply !
It's a windows program, do i have to add something to the asm code to don't have to put /entry:... each time i compile ?
From C, you can use this pragma:
#pragma comment(linker, "/entry:_WinMain@16")
From assembler you can put directives in a section called
.drectve:
db " -entry:_WinMain@16"
db " -defaultlib:mylib.lib"
(The exact syntax depends on your assembler, which I don't know well enough.)
Quote from: "GTN"In fact i've found a problem with using this method: It opens a console, but it's not a console app, what can i do to don't show this console ?
GTN
You must specify the correct subsystem to the linker: /subsystem:windows. Default in most cases is: /subsystem:console.
Pelle
Hi GTN,
Here is a simple FASM Ms Coff sample for you:
format MS COFF
public start
Include '%fasminc%\win32a.inc'
extrn '__imp__ExitProcess@4' as ExitProcess:dword
extrn '__imp__MessageBoxA@16' as MessageBox:dword
section '.data' data readable writeable
caption db 'Hello',0
message db 'This is a FASM example',0
section '.code' code readable executable
start:
invoke MessageBox,0,message,caption,MB_OK
invoke ExitProcess,0
Building the executable:
set fasminc=\fasmw\include
call povars32.bat
fasm Msgbox.asm
polink /SUBSYSTEM:WINDOWS /ENTRY:start Msgbox.obj kernel32.lib user32.lib
Hi !
Thanks for all, it works !!
GTN
Hi!
Earlier I've been able to use FASM with Pelles C to compile assembly files to MS COFF objects, but when I try now, the following command line is produced - which is not the one to use with FASM! I tried to set the ASFLAGS to the files I wanted to assemble etc., but these two arguments are automatically appended anyway... :roll:
fasm.exe -Fo"<...>\output\<...>.obj" "<...>\<...>.asm"
<...> = path and file name
Is there a work-around or could you fix this Pelle?? Thanks! (I'm quite sure it worked just a few months ago, is it something with the newest releases? Or am I lost :S :D)
Regards,
Tommy
Hello,
The following command string is currently used for *all* assemblers:
$(AS) $(ASFLAGS) -Fo"$@" "$!"
you can tune the AS and ASFLAGS macros, but -Fo is always there. AFAIK it has always been like this. In my experience, most compilers/assemblers/translators disagree about command line options, but most of them agrees on a -Fo (or /Fo) option. I guess I should add a way of specifying the entire command line for external assemblers (putting -Fo in ASFLAGS isn't very nice).
Now the work-around: change to target view in the project window (click target files button), right-click on the object file, and select Properties from the menu - now you should see the build command(s). Change it to something that FASM likes... ;)
Pelle
:D Thanks!