Message board for the users of flat assembler.
> High Level Languages > Linking Source with a API-Procedure
I wanted to link this source:
format MS COFF extrn _Str extrn '__imp__ExitProcess@4' As ExitProcess:dword extrn '__imp__MessageBoxA@16' as MessageBox:dword section '.text' code readable executable public _4compiler _4compiler: push 5 call _Str mov [var],eax push 0 push _S4 push [var] push 0 call [MessageBox] ;______________________________ push 0 call [ExitProcess] ret section '.data' Data readable writeable var dd ? _S4 db "Test",0
with this one:
format MS COFF extrn '__imp__wsprintfA@8' as Convert:dword section '.text' code readable writeable shareable public _Str _Str: pop edx pop eax push edx push eax push _S3 push buffer call [Convert] mov eax,[buffer] ;<- here's the error to my mind ret section '.data' Data readable writeable _S3 db "%d",0 buffer dd ?
I want to know how to transport register between two compiled obj ?
It would be helpfull if you give me links and tutorials about writing and calling procedures in assembly, too
|18 Jan 2007, 19:51||
What do you mean by transport register?
You probably want to link these together, if you are using MS Link or Polink, a linker response file looks something like this:
-heap:0xF4240,0xF4240 -stack:0xF4240,0xF4240 -base:0x4000000 -entry:_4Compiler -section:.data,RW -section:.text,ER -machine:ix86 -subsystem:windows -nologo -out:demo.exe kernel32.lib user32.lib str.obj comp.obj
This is assuming your files are called "str.asm" and "comp.asm" change them as necessary.
I see you also use one of the C libraries. I don't know what its called, you'll have to link in that library too.
Also, I believe the C calling convention is different. You have to balance the stack by adding the byte value of all the pushed parameters to ESP.
To link, assuming the linker response file is called "comp.link"
> polink @comp.link
The book covers everything from low level aspects to high level displays and frames, along with many different calling conventions.
|19 Jan 2007, 06:21||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.