hi there,
i wanted to call standard c library functions like printf , ststr , etc directly from masm code. But the problem is that i dont have the inc/lib files for C runtimes.
any help will be highly appreciated :D
thanks in advance !
i wanted to call standard c library functions like printf , ststr , etc directly from masm code. But the problem is that i dont have the inc/lib files for C runtimes.
any help will be highly appreciated :D
thanks in advance !
http://www.asmcommunity.net/board/index.php?topic=9531&highlight=printf
Have a look at it, though it is in FASM.
Have a look at it, though it is in FASM.
so this should work with masm ????
Yes,why not? :) You can check the thread:
http://www.asmcommunity.net/board/index.php?topic=10168&highlight=A+very+small+lib
http://www.asmcommunity.net/board/index.php?topic=10168&highlight=A+very+small+lib
btw who cares about masm anymore.FASM is delicious !!!!!
Hello,
yet to importing from C libs, I'm writing this prototyp file self adding prototypes as needed, no prob with it, just to check how many args the func takes:
_strcmp proto C :DWORD, :DWORD
done.
Does anybody know how to avoid RT error doing some calls to static library (eg printf etc..)..?
I guess there should be done some extra init as the CRTWinMain is overriden by asm (if I look at that it does some init surely - heap and more), no problem with runtime lib.
thanks.
yet to importing from C libs, I'm writing this prototyp file self adding prototypes as needed, no prob with it, just to check how many args the func takes:
_strcmp proto C :DWORD, :DWORD
done.
Does anybody know how to avoid RT error doing some calls to static library (eg printf etc..)..?
I guess there should be done some extra init as the CRTWinMain is overriden by asm (if I look at that it does some init surely - heap and more), no problem with runtime lib.
thanks.
so this should work with masm ????
btw who cares about masm anymore.FASM is delicious !!!!!
Himanshu,I think you are a bit confused. :)
Here is a quick example of using C library functions in asm.
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
includelib crtdll.lib
printf PROTO C a1:DWORD,:VARARG
strcat PROTO C a1:DWORD,a2:DWORD
.data
m1 db 'This is'
db 12 dup(0)
m2 db ' an example',0
format db '%s',0
.code
start:
invoke strcat,ADDR m1,ADDR m2
invoke printf,ADDR format,ADDR m1
invoke ExitProcess,0
end start
oh ,thanks man !
Himanshu,you are welcome. :)
i think i am going to like this cheerful board :D
winasm was never such fun !
winasm was never such fun !
Complier shoots out a fast program like a bullet.
There are brands of guns and compliers.
I like the feel and comfort of my gun, shoots the way I want it to.
So I'll stick to my M$ ml.6.14.8444.
That does not mean your gun does not kill a problem dead like mine, just, I like mine and you like yours.
Regards, P1
There are brands of guns and compliers.
I like the feel and comfort of my gun, shoots the way I want it to.
So I'll stick to my M$ ml.6.14.8444.
That does not mean your gun does not kill a problem dead like mine, just, I like mine and you like yours.
Regards, P1
hmmm... cant i just use the msvcrt.lib for importing C runtimes ??????
Yes,Himanshu you can use also the functions of msvcrt.dll
Regards,
Vortex
Regards,
Vortex