flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > Error: invalid expression

Author
Thread Post new topic Reply to topic
Cos



Joined: 06 Dec 2018
Posts: 3
I just started Assembly class, and got stuck with this error wile compiling :

flat assembler version 1.73.04 (1048576 kilobytes memory)
1_console.asm [34]:
import kernel,\
C:\Program Files (x86)\fasmw\INCLUDE/macro/import32.inc [31] import [5]:
if used label
processed: if used
error: invalid expression.


I double checked invirmental variables, code, and don't have any idea what is wrong.

Whhat I understand that there is problem with 'if used' label within import32.inc file.


Last edited by Cos on 06 Dec 2018, 17:40; edited 1 time in total
Post 06 Dec 2018, 05:29
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 452
Location: Belarus
One line might not always be enough. One possibility is that kernel module has not been defined with library macro, another one might be in a way you’re defining the functions to import in the next few lines (for some definition of “few”).
Post 06 Dec 2018, 08:24
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
Please show more source to give context. import is a macro that takes many parameters, and we can't see the other lines after the line continuation trailing backslash.
Post 06 Dec 2018, 12:06
View user's profile Send private message Visit poster's website Reply with quote
Cos



Joined: 06 Dec 2018
Posts: 3
There is source code I used:
Code:
format PE console

entry start

include 'win32a.inc' 

; ===============================================
section '.text' code readable executable

start:
        ; Your program begins here:
        inc     eax
        inc     eax
        dec     eax
        inc     eax

        ; Exit the process:
        push    0
        call    [ExitProcess]
        
; ====================================
; Imports section:


section '.idata' import data readable

library kernel,'kernel32.dll'

import  kernel,\

        ExitProcess,'ExitProcess'    
Post 06 Dec 2018, 14:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16128
Location: Hyperborea
So the problem is the blank line after the import. If you remove the blank line then it will assemble.
Code:
format PE console

entry start

include 'win32a.inc'

; ===============================================
section '.text' code readable executable

start:
        ; Your program begins here:
        inc     eax
        inc     eax
        dec     eax
        inc     eax

        ; Exit the process:
        push    0
        call    [ExitProcess]

; ====================================
; Imports section:


section '.idata' import data readable

library kernel,'kernel32.dll'

import  kernel,\
        ExitProcess,'ExitProcess'    
The backslash is for line continuation so another option is to add a second backslash:
Code:
format PE console

entry start

include 'win32a.inc'

; ===============================================
section '.text' code readable executable

start:
        ; Your program begins here:
        inc     eax
        inc     eax
        dec     eax
        inc     eax

        ; Exit the process:
        push    0
        call    [ExitProcess]

; ====================================
; Imports section:


section '.idata' import data readable

library kernel,'kernel32.dll'

import  kernel,\
\
        ExitProcess,'ExitProcess'    
Post 06 Dec 2018, 22:20
View user's profile Send private message Visit poster's website Reply with quote
Cos



Joined: 06 Dec 2018
Posts: 3
Thanks, its works now. Appreciate your help.
Post 07 Dec 2018, 00:22
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.