flat assembler
Message board for the users of flat assembler.
Index
> Main > Strings, Pointers, and Invoke Parameters |
Author |
|
cod3b453 26 Jan 2010, 13:27
The symbol v_strX holds the address of (or is a pointer to-) the data you define. [v_strX] holds the dword or 4 bytes at that address. It seems your AddString works on two pointers so you would want to do:
Code: invoke AddString,v_str1,v_str2 ; I believe FASM does this at compile time instead of "Hello ","World!" v_str1 db 'Hello ',0 v_str2 db 'World!',0 If instead you wanted the values of v_strX to be pointers (like rd suggests) to strings: Code: invoke AddString,[v_str1],[v_str2] ; ~ s_hello,s_world v_str1 dd s_hello v_str2 dd s_world s_hello db 'Hello ',0 s_world db 'World!',0 Hope that helps |
|||
26 Jan 2010, 13:27 |
|
fasmnub 26 Jan 2010, 13:35
That makes things a bit clearer.. but the function in the .dll needs to take actual strings, not pointers. (string in-->string out to eax)
v_str1 and v_str2 need to be declared undefined, and changeable (with changeable size) As a high-level coder with no asm experience this is all really confusing. |
|||
26 Jan 2010, 13:35 |
|
revolution 26 Jan 2010, 13:40
You can't "return a string in eax". The eax register is only 32 bits long, enough for only 3 characters plus a terminating null. You have to pass pointers, there is no other way. Your HL language may have been hiding this detail from you.
|
|||
26 Jan 2010, 13:40 |
|
fasmnub 26 Jan 2010, 14:00
I had a feeling I was doing something drastically wrong.
Can someone show a quick example of dynamically working with strings (that aren't pre-defined, but can hold any string/length), concatenation, passing string values with invoke etc.. I'd appreciate any help/info you can give, baring in mind that i have virtually no experience with asm, but the high-level/external stuff is no problem. |
|||
26 Jan 2010, 14:00 |
|
revolution 26 Jan 2010, 14:14
For dynamic strings you would allocate/deallocate memory on the fly instead of using fixed string definitions.
|
|||
26 Jan 2010, 14:14 |
|
Borsuc 26 Jan 2010, 19:58
Well maybe you should learn pointers first? Most "dynamic" parameters are passed via pointers.
|
|||
26 Jan 2010, 19:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.