flat assembler
Message board for the users of flat assembler.
Index
> Main > use addr macro |
Author |
|
revolution 26 Sep 2009, 15:42
Always show all of your code because faults like this can be caused by other parts of the code.
Check that you have included the 'x' versions of the win functions (win32ax.inc & win32wx.inc): Code: include 'win32ax.inc' |
|||
26 Sep 2009, 15:42 |
|
e4key 26 Sep 2009, 15:47
win32ax included. in my file > 500 lines i write callback function for work with sqlite :
Code: proc CallBack c, data, nCols, rows, headers locals hostBuffer rb 45 nameBuffer rb 45 endl mov ebx, [rows] ... sub eax, eax ret endp and error shows in my first function in this procedure. |
|||
26 Sep 2009, 15:47 |
|
e4key 26 Sep 2009, 15:48
if i write:
Code: lea eax, [nameBuffer] push eax call [lstrlen] all works |
|||
26 Sep 2009, 15:48 |
|
revolution 26 Sep 2009, 15:52
We can't help you because you have not included enough code to show the place of the error.
If you don't want to post it all then minimize to the point of just one function or something and strip out lines until just the fault is present. Give us something that we can assemble and see the error. BTW: just doing this part can often show the error to you and you won't need to wait for someone here to help. |
|||
26 Sep 2009, 15:52 |
|
LocoDelAssembly 26 Sep 2009, 15:58
This compiles to me:
Code: include 'win32ax.inc' proc CallBack c, data, nCols, rows, headers locals hostBuffer rb 45 nameBuffer rb 45 endl invoke lstrlen, addr nameBuffer ret endp .end CallBack |
|||
26 Sep 2009, 15:58 |
|
e4key 26 Sep 2009, 16:03
ok i write next small example
Code: format PE GUI 4.0 entry main include 'win32ax.inc' section '.data' data readable writeable hello db 'hello', 0 hdb dd ? dbName db 'hehe.sqlite', 0 sql db 'SELECT hehe FROM hello', 0 dumpbuff rb 1024 dumpfmt db 'hehe: %s', 0 section '.code' code readable executable main: invoke sqlite3_open, dbName, hdb invoke sqlite3_exec, [hdb], sql, CallBack, 0, 0 invoke sqlite3_close, [hdb] invoke ExitProcess, 0 proc CallBack c, data, nCols, rows, headers locals hostBuffer rb 45 endl mov ebx, [rows] invoke lstrcpy, addr hostBuffer, [ebx] sub eax, eax ret endp section '.idata' import data readable writeable library kernel32, 'kernel32.dll',\ user32, 'user32.dll',\ sqlite3, 'sqlite3.dll' import sqlite3,\ sqlite3_open, 'sqlite3_open',\ sqlite3_exec, 'sqlite3_exec',\ sqlite3_close, 'sqlite3_close' include 'api\kernel32.inc' include 'api\user32.inc' |
|||
26 Sep 2009, 16:03 |
|
revolution 26 Sep 2009, 16:08
Are you sure this code generates the same error? I get "error: operand size not specified." because of the the [ebx] parameter. If I remove the [ebx] then it compiles fine.
|
|||
26 Sep 2009, 16:08 |
|
e4key 26 Sep 2009, 16:09
LocoDelAssembly. hmm... this code not compiles
fasm v1.69.04 |
|||
26 Sep 2009, 16:09 |
|
LocoDelAssembly 26 Sep 2009, 16:09
invoke lstrcpy, addr hostBuffer, [ebx] > invoke lstrcpy, addr hostBuffer, ebx
If rows is pointer to pointer then invoke lstrcpy, addr hostBuffer, dword [ebx] |
|||
26 Sep 2009, 16:09 |
|
e4key 26 Sep 2009, 16:14
LocoDelAssembly, yes, rows is pointer to pointer thanks.
|
|||
26 Sep 2009, 16:14 |
|
LocoDelAssembly 26 Sep 2009, 16:14
Quote:
I've used FASMW 1.69.05 and it compiles if it is copied and pasted exactly (and Include in FASMW.INI is set to point to the package includes) Don't run it however, since the application will surely crash. |
|||
26 Sep 2009, 16:14 |
|
farrier 26 Sep 2009, 18:34
e4key,
You should be using the cinvoke instead of invoke to call the sqlite functions, since they are not stdcall functions. hth, farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
26 Sep 2009, 18:34 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.